Home > Web Front-end > JS Tutorial > Why Does Chrome 67 Return an Inaccurate Time Zone Offset for Pre-1970 Dates?

Why Does Chrome 67 Return an Inaccurate Time Zone Offset for Pre-1970 Dates?

Barbara Streisand
Release: 2024-11-10 05:55:02
Original
510 people have browsed it

Why Does Chrome 67 Return an Inaccurate Time Zone Offset for Pre-1970 Dates?

Browsers, Time Zones, and the Issue with Chrome 67 (Historic Time Zone Changes)

In response to a Chrome update to version 67, a user encountered an inconsistency in date time zone offsets. Specifically, the user noticed a difference in the offset values returned by various browsers when retrieving time zone information for dates prior to 1970.

Observed Error:

In Chrome 67, new Date("1900-01-01T00:00:00").getTimezoneOffset() returned -150, indicating a time zone offset of 2 hours and 30 minutes from UTC, while other browsers returned -180 (UTC 3).

Explanation:

This difference is due to a change in how Chrome 67 handles historic time zone data. Prior to 1919, the time zone offset in Europe/Moscow was 2 hours and 30 minutes, not an integer number of hours. Chrome 67 rounds down to the nearest whole hour, resulting in the observed -150 offset.

Impact:

The inconsistency can affect applications that rely on time zone-sensitive information, particularly for dates prior to 1970.

Resolution:

To mitigate this issue, it is recommended to modify code to avoid requesting time zone information for dates before 1970, as the IANA time zone database may not provide fully accurate data for that period. Additionally, it is worth considering the potential impact of this change on existing code that may have relied on the previous time zone offset behavior in Chrome.

The above is the detailed content of Why Does Chrome 67 Return an Inaccurate Time Zone Offset for Pre-1970 Dates?. 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