5
userAgent:`Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.7 Safari/537.36`

In Chrome Devtools, running new Date(1899, 1, 10) will yield the string:

Fri Feb 10 1899 00:00:00 GMT+0805 (中国标准时间)

But in other browsers it returns:

Fri Feb 10 1899 00:00:00 GMT+0800 (中国标准时间)

0800 is correct. Why does 0805 appear?

Boann
  • 48,794
  • 16
  • 117
  • 146
Gavin Yang
  • 121
  • 1
  • 5
  • 3
    `GMT+0805` ... wow! there's some weird stuff going on at chrome headquarters ... have you tried the current chrome? 67? 68 seems to be a beta release so may have bugs ... like non-existent timezones – Jaromanda X Jun 01 '18 at 09:18
  • Guess what I got? `Fri Feb 10 1899 00:00:00 GMT+0646 (Malaysia Time)`. Running on version 67 – Thum Choon Tat Jun 01 '18 at 09:20
  • I correctly received `Fri Feb 10 1899 00:00:00 GMT+0530 (IST)` on `Version 66.0.3359.181 (Official Build) (64-bit)` – 31piy Jun 01 '18 at 09:23
  • 1
    maybe back in 1899, there were no timezones like we have today, and Chrome guesses the zone from the geographic longitude of the current location – Jaromanda X Jun 01 '18 at 09:25

1 Answers1

5

Looking at this website, for Shanghai, they had a GMT+0805 from < 1800 up to 1900.

enter image description here

This changed in 1901 when they removed the extra 5 minutes, becoming GMT+0800.

enter image description here

Same reason why user Thum Choon Tat gets GMT+0646. in the comments.

This said, it looks like Chrome goes a little further than other browsers in determining the timezone.

Nico Van Belle
  • 4,911
  • 4
  • 32
  • 49
  • 1
    What chrome is doing is to have a correct representation of the time back then. Assume that you want to have a time difference between a moment in that period and, let's say the start of WWII, then it should return with the right amounts of milliseconds.The java 8 time API has such exceptions too. Shanghai is not alone with that. – KarelG Jun 01 '18 at 09:52
  • @KarelG Yes you are correct. Note I'm merely using Shanghai here as one example but there are, of course, many. – Nico Van Belle Jun 01 '18 at 09:54
  • Not a lot people is aware of that. I discovered it (with other exceptions) when troubleshooting a bug issue in an old module which was caused by - what a coincidence - Shanghai's time representation before 1901. – KarelG Jun 01 '18 at 10:00
  • @GavinYang I don't know how this is implemented in Chrome. Could be that there are differences in the Windows and Mac builds. Or perhaps the underlying OS makes the difference.On my Mac, for Belgium where I live, I indeed also only get the 'modern' timezones if you can call it so. – Nico Van Belle Jun 01 '18 at 11:05