gpt4 book ai didi

javascript - 浏览器、时区、Chrome 67 错误(历史时区更改)

转载 作者:搜寻专家 更新时间:2023-11-01 05:19:47 26 4
gpt4 key购买 nike

我已经将 Chrome 更新到 67 版本。我收到日期错误

==============

微软边缘 42.17134.1.0

new Date("1900-01-01T00:00:00").getTimezoneOffset() 

-180

new Date("2018-05-30T00:00:00").getTimezoneOffset()

-180

Microsoft Internet Explorer 11.48.17134.0

new Date("1900-01-01T00:00:00").getTimezoneOffset() 

-180


new Date("2018-05-30T00:00:00").getTimezoneOffset()

-180

火狐浏览器 60.0.1

new Date("1900-01-01T00:00:00").getTimezoneOffset() 

-180

new Date("2018-05-30T00:00:00").getTimezoneOffset()

-180

Chrome 67.0.3396.62

new Date("1900-01-01T00:00:00").getTimezoneOffset() 

-150

new Date("2018-05-30T00:00:00").getTimezoneOffset()

-180

======================

-150 在 Chrome 67 中...

另一个例子(Chrome 67):

new Date("1900-01-01T00:00:00");

Mon Jan 01 1900 00:00:00 GMT+0230 (Moscow Standard Time)

======================

在 Chrome 67 中,时区开始不正确(+0230,原为:+0300)

请告诉我?

我能做什么?

情况很重要!我必须重写所有代码...

======================

最佳答案

我假设您处于 Europe/Moscow 时区 - 考虑到您提供的输出,这似乎很可能。

1900 年,欧洲/莫斯科时区的偏移量为 +02:30:17,according to the IANA time zone database .据推测,Chrome 正在向下舍入到 02:30 以避免亚分钟偏移,但据我所知,它正在返回适当的数据。至少根据 IANA 数据库,俄罗斯的偏移量在 1919 年首次成为整数小时数。

按理说,您应该问为什么其他浏览器不这样做 - 但更有可能的是,您应该更改代码以不询问 1970 年之前的时区信息。IANA 数据库旨在提供从 Unix 纪元开始的准确数据;任何更早的事情都是“尽力而为”。来自theory file :

Clock transitions before 1970 are recorded for each such location, because most systems support timestamps before 1970 and could misbehave if data entries were omitted for pre-1970 transitions. However, the database is not designed for and does not suffice for applications requiring accurate handling of all past times everywhere, as it would take far too much effort and guesswork to record all details of pre-1970 civil timekeeping. Although some information outside the scope of the database is collected in a file backzone that is distributed along with the database proper, this file is less reliable and does not necessarily follow database guidelines.

如果您在以前版本的 Chrome 中没有看到它,为什么您会在 Chrome 67 中看到它 - 我想知道 Chrome 是否刚刚开始捆绑 IANA 时区数据而不是使用操作系统数据。

关于javascript - 浏览器、时区、Chrome 67 错误(历史时区更改),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50609860/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com