Created
March 20, 2023 01:51
-
-
Save drodsou/1df8c20cb4d26313ee1c72cc79884ada to your computer and use it in GitHub Desktop.
timezoneISOString - javascript
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
/** | |
* like toISOString but preserving current timezone correct hour | |
*/ | |
function timezoneISOString (aDate) { | |
return new Date(aDate.getTime() - (aDate.getTimezoneOffset() * 60000)).toISOString(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment