date: fix timezone abbreviations using wrong offset outside their DST season#11045
Merged
cakebaker merged 1 commit intouutils:mainfrom Feb 21, 2026
Merged
Conversation
Contributor
Author
|
This supersedes #11043 (MEZ/MESZ only) with a broader fix. The simpler PR is there as a fallback if this refactor needs more discussion. |
Merging this PR will improve performance by 8.91%
Performance Changes
Comparing Footnotes
|
|
GNU testsuite comparison: |
Contributor
|
Thanks for your PR! |
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
EDT/PDT/CDT/MDT were being mapped to IANA region names (e.g. EDT →
America/New_York), which meant
dt.to_zoned(tz)would pick whateveroffset the region has on that date. So "10:00 EDT" in January would
resolve to UTC-5 (EST) instead of UTC-4, because New York is in
standard time in winter. But EDT means UTC-4, always — the abbreviation
itself says it's daylight time.
Replaced
PREFERRED_TZ_MAPPINGSwithFIXED_OFFSET_ABBREVIATIONSthatstores the actual UTC offset in seconds for each abbreviation. Seconds
instead of hours because IST is UTC+5:30 and ACST is UTC+9:30. The
dynamic IANA database fallback is still there for anything not in the
static table.
Also adds MEZ/MESZ while I was in there (fixes #11015).
Ref: https://data.iana.org/time-zones/theory.html
Ref: https://www.rfc-editor.org/rfc/rfc9557.html#section-2
Fixes #10805
Fixes #11015