I am in (UTS-05: 00) Eastern Time (USA and Canada)
ie, new Date().getTimezoneOffset() == 300seconds.
Now I have an API endpoint (JSON) that returns a date string like this.
{
someDate: '2016-01-01T00:40:00.000+00:00'
}
Here I pass it to a Date constructor like this
var dateString = "2016-01-01T00:40:00.000+00:00";
var someDay = new Date(dateString);
console.log(someDay)
Run codeHide resultMozilla Firefox Console Shows
Date {Fri 01/01/2016 00:40:00 GMT-0500 (Eastern Daylight Saving)}
Google Chrome console shows
Thu Dec 31 2015 19:40:00 GMT-0500 (Eastern Standard Time)
Chrome takes into account TimezoneOffset, but Firefox does not. What can I do to get a date that doesn't take bias into account like FireFox in Chrome?
source
share