Skip to content

Instantly share code, notes, and snippets.

@gr2m
Created September 27, 2010 09:17
Show Gist options
  • Save gr2m/598793 to your computer and use it in GitHub Desktop.
Save gr2m/598793 to your computer and use it in GitHub Desktop.
Preconditions:
* set your timezone to Auckland, New Zealand.
Description
There is a bug with the Date Object. »new Date("2010/9/26")« returns
»Sat Sep 25 2010 23:00:00 GMT+1200 (NZST)«
Expected result
»Sat Sep 26 2010 00:00:00 GMT+1200 (NZST)«
Reproduce in Console:
> new Date("2010/9/25")
=> Sat Sep 25 2010 00:00:00 GMT+1200 (NZST)
> new Date("2010/9/26")
=> Sat Sep 25 2010 23:00:00 GMT+1200 (NZST)
> new Date("2010/9/27")
=> Mon Sep 27 2010 00:00:00 GMT+1300 (NZDT)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment