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
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!