Updated a couple tests so they work in all timezones.
Also a small change to isLeapYear. In my super comprehensive testing (my current versions of node, chrome and firefox), new Date consistently parses 'YYYY-MM-DD' strings as UTC, while 'YYYY-MM-DD HH:MM:SS' strings and the Number -> Number -> Number -> Date version consistently treat their arguments as local time. For me, isLeapYear would then have ${date.getFullYear()}-02-29 become 2015-03-01T00:00:00.000Z in non-leap years, which is still February for negative offsets so getMonth will always return 1.
This of course will all sort itself out once #41 is resolved, but I've done my best to come up with a reasonable solution in the mean time.
Updated a couple tests so they work in all timezones.
Also a small change to
isLeapYear
. In my super comprehensive testing (my current versions of node, chrome and firefox),new Date
consistently parses 'YYYY-MM-DD' strings as UTC, while 'YYYY-MM-DD HH:MM:SS' strings and theNumber -> Number -> Number -> Date
version consistently treat their arguments as local time. For me,isLeapYear
would then have${date.getFullYear()}-02-29
become2015-03-01T00:00:00.000Z
in non-leap years, which is still February for negative offsets sogetMonth
will always return 1.This of course will all sort itself out once #41 is resolved, but I've done my best to come up with a reasonable solution in the mean time.