12-23-2017 05:55
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

12-23-2017 05:55
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
The JS Date object on the Ionic does not appear to be correctly respecting daylight savings time. I'm trying to work with dates in the future, in the Eastern US timezone.
The correct unix timestamp for midday (12:00) on July 1st 2018 should be 1530460800000.
In Chrome, this will create the following date via new Date(1530460800000).
Sun Jul 01 2018 12:00:00 GMT-0400 (EDT)
And getTimezoneOffset() returns 240 for that date. Which is correct, a 4 hour difference to UTC.
However, the same code run on the Ionic returns:
Sun Jul 01 2018 11:00:00 GMT-05:00
And getTimezoneOffset() returns 300 for that date. Which is incorrect, is is still a 5 hour difference.
This is pretty problematic when trying to work with dates in the past and future. Am I missing something here, or is this a bug?
You can try it for yourself with the code below:
let unix_ts_jul = 1530460800000;
let date_jul = new Date(unix_ts_jul);
console.log("Date for 1st July from TS");
console.log(date_jul);
console.log("TZ offset for 1st July from TS");
console.log(date_jul.getTimezoneOffset());
Answered! Go to the Best Answer.
Accepted Solutions
01-16-2018 15:18
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


01-16-2018 15:18
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Thanks for reporting this, I've raised it with the firmware team, and will update you when I find out more.

01-16-2018 15:18
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


01-16-2018 15:18
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Thanks for reporting this, I've raised it with the firmware team, and will update you when I find out more.

