为什么新的Date()会在Chrome中返回错误的时区?

时间:2018-06-01 09:15:57

标签: javascript google-chrome date

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

在Chrome Devtools中,运行new Date(1899, 1, 10)会产生字符串:

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

但在其他浏览器中它返回:

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

0800是正确的。为什么会出现0805?

1 个答案:

答案 0 :(得分:4)

查看this website,对于上海,他们有GMT+0805来自< 1800年至1900年。

enter image description here

这种情况在1901年发生了变化,当时他们删除了额外的5分钟,成为GMT+0800

enter image description here

用户Thum Choon Tat在评论中获得GMT+0646.的原因相同。

这就是说,看起来Chrome在确定时区方面比其他浏览器更进一步。

相关问题