Date Parsing issue with chrome alone tha too only in latest version (not in firefox and IE and Edge)

179 views
Skip to first unread message

Prem Kumar

unread,
Jul 20, 2018, 2:39:45 AM7/20/18
to Chrome DevTools

I am currently in UTC +2 timezone (tripoli). While assigning a date value in ISO string, date values get adjusted with DateLightSaving settings I suspect and the date value itself gets changes. Please check the below link to reproduce the issue.


Link: https://codepen.io/anon/pen/bjbodJ


In the edge browser the value is retunred correctly (Firefox, IE also returns correct value). But value changes only with Google Chrome that too only with current latest version but works fine with older version (65).

Edge working screenshot:




Chrome issue screenshot:



In the above two screenshots, you can find that the date value has been changed in the Chrome browser by 1 day. whereas it displays same value in Edge browser (also fine with mozilla and IE).

Can anyone suggest on this.

PhistucK

unread,
Jul 20, 2018, 3:21:12 AM7/20/18
to Google Chrome Developer Tools
This is off topic for this group. Please, use crbug.com or chromium-discuss. Do not continue this discussion here.

Note that in 1937, there was no daylight saving time in Tripoli and it was GMT + 1 throughout the entire year so the correct date would be 25, not 26.
Reference -

I tried this code and it kept returning the same results when I tried in different Chrome versions -
a = new Date("1937-02-25T22:00:00.000Z")
console.log(new Intl.DateTimeFormat("en-us", {timeZone: 'Africa/Tripoli', era: "long", hour: "numeric", day: "numeric", month: "numeric", year: "numeric", minute: "numeric", second: "numeric", timeZoneName: "long"}).format(a));
console.log(new Intl.DateTimeFormat("en-us", {timeZone: 'Asia/Jerusalem', era: "long", hour: "numeric", day: "numeric", month: "numeric", year: "numeric", minute: "numeric", second: "numeric", timeZoneName: "long"}).format(a));

Edge 17 (and the Insider preview) does show 26, which seems to be wrong. Firefox 61 and Safari 11.1 show the same as Chrome.

Hint - new Intl.DateTimeFormat().resolvedOptions() will tell you what time zone the browser thinks you use. You can compare the results in 65 (if you still have it somewhere) versus 67 or the version you use.

PhistucK


--
You received this message because you are subscribed to the Google Groups "Chrome DevTools" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-chrome-develo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-chrome-developer-tools/5a35747a-cfe1-433e-a7ab-117901220013%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages