NaN is short for "not a number", so you need to validate against !isNan() to check if it's a number.
The leap year rules is: Every forth year, but only if not dividable by 100 but not 400. For example, the year 2000 was a leap year because it's dividable by 400. Your current code returns 28 days for the year 2000.
It would be great having those changes on NPM. Cheers!
This PR fixes two rather annoying bugs:
NaN
is short for "not a number", so you need to validate against!isNan()
to check if it's a number.It would be great having those changes on NPM. Cheers!