Created
July 11, 2017 12:50
-
-
Save yangwao/5223042dfe17c2267ff433dc515c2d93 to your computer and use it in GitHub Desktop.
Date mystery with timezones
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Local | |
⫸ node -v | |
v0.12.18 | |
> date = new Date(2017, 06, 01) | |
Sat Jul 01 2017 00:00:00 GMT+0200 (CEST) | |
> Math.floor(date/(86400*1000)) + 1 | |
17348 | |
> date = new Date(Date.UTC(2017, 06, 01)) | |
Sat Jul 01 2017 02:00:00 GMT+0200 (CEST) | |
> Math.floor(date/(86400*1000)) + 1 | |
17349 | |
Server | |
node -v | |
v0.12.18 | |
> date = new Date(2017, 06, 01) | |
Sat Jul 01 2017 00:00:00 GMT+0000 (UTC) | |
> Math.floor(date/(86400*1000)) + 1 | |
17349 | |
> date = new Date(Date.UTC(2017, 06, 01)) | |
Sat Jul 01 2017 00:00:00 GMT+0000 (UTC) | |
> Math.floor(date/(86400*1000)) + 1 | |
17349 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment