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)

    I'm listening to The Ickabog, by J.K. Rowling and read, with much gusto, by Stephen Fry. What started like a nice children's tale not dissimilar from…

  • (no subject)

    From today's questions to the Prime Minister: Mr Speaker, today, millions of Uyghur people in China live in fear under a cruel regime. The BBC,…

  • (no subject)

    There's a strange tendency out there for tech podcasters not to be good programmers themselves. There are exceptions, of course. The googlers at…

  • 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