Last active
October 6, 2018 18:49
-
-
Save bchase/312d8ae5b86a54d526e2fa305fd46cdc to your computer and use it in GitHub Desktop.
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
// what we get | |
new Date('2018-10-01') | |
// Sun Sep 30 2018 20:00:00 GMT-0400 (Eastern Daylight Time) | |
// what we want | |
new Date('2018-10-01 GMT-0400') | |
// Mon Oct 01 2018 00:00:00 GMT-0400 (Eastern Daylight Time) | |
// getting it :) | |
var tz = new Date().toString().match(/[^\s]+[-+]\d{4}/)[0] | |
new Date('2018-10-01' + ' ' + tz) | |
// Mon Oct 01 2018 00:00:00 GMT-0400 (Eastern Daylight Time) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment