Created
June 29, 2021 14:10
-
-
Save topogigiovanni/30fad0b0e467212b9c4d9b476752c49e to your computer and use it in GitHub Desktop.
https://stackoverflow.com/questions/10830357/javascript-toisostring-ignores-timezone-offset
to iso string local
This file contains hidden or 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
| var tzoffset = (new Date()).getTimezoneOffset() * 60000; //offset in milliseconds | |
| var localISOTime = (new Date(Date.now() - tzoffset)).toISOString().slice(0, -1); | |
| // => '2015-01-26T06:40:36.181' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment