Home > Web Front-end > JS Tutorial > body text

Why Does Chrome 67 Produce Time Zone Errors for Dates Before 1970?

Barbara Streisand
Release: 2024-11-08 12:25:01
Original
982 people have browsed it

Why Does Chrome 67 Produce Time Zone Errors for Dates Before 1970?

Chrome 67 Error: Historic Time Zone Changes

Problem Description

Upon updating to Chrome 67, users encounter an error when retrieving timezone offsets for dates prior to 1970. For example, in the Europe/Moscow time zone:

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

new Date("2018-05-30T00:00:00").getTimezoneOffset() 
-180
Copy after login

Explanation

In 1900, the Europe/Moscow time zone had an offset of 02:30:17. Chrome 67 appears to be rounding down to 02:30 to avoid sub-minute offsets, resulting in the observed behavior.

Why Other Browsers Don't Exhibit This Error

Other browsers may not be applying this rounding behavior or may be using a different time zone database.

Best Practices

To avoid this error, applications should not request time zone information for dates prior to 1970. The IANA time zone database aims to provide accurate data from the Unix epoch onwards, while data for earlier periods is less reliable.

Possible Reason for Change in Chrome 67

Speculation suggests that Chrome 67 may have begun bundling IANA time zone data rather than relying on OS data. This would account for the difference in behavior from previous versions of Chrome.

The above is the detailed content of Why Does Chrome 67 Produce Time Zone Errors for Dates Before 1970?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!