cullophid / date-fp

Functional programming date manipulation library
121 stars 17 forks source link

update tests to work in all timezones #47

Closed kedashoe closed 8 years ago

kedashoe commented 8 years ago

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.

svozza commented 8 years ago

Thanks! You'll need to bump the patch version in package.json before I can merge this.

kedashoe commented 8 years ago

patch version updated

svozza commented 8 years ago

Brilliant. Thanks these PRs, much appeciated!