Andrey (azangru) wrote,
Andrey
azangru

Из архивов Stack Overflow:

Вопрос: Check if year is leap year in javascript

Первый ответ:



Несколько позже другой ответ:



Хмм. Смотрю в исходники библиотеки:

return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0


the dirty details of getting all of the special cases right, говорите?
Subscribe

  • (no subject)

    This is one other lesson that I haven't learnt in time, and that I am afraid might bite me, hard. We are using Jest, mocking module dependencies left…

  • (no subject)

    Is concurrent mode a failed promise already?

  • (no subject)

    I've never watched a long conversation with Jay Bhattacharya before — only his occasional quick appearances on mainstream news. This conversation…

  • Post a new comment

    Error

    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 0 comments