Skip to content

date: fix timezone abbreviations using wrong offset outside their DST season#11045

Merged
cakebaker merged 1 commit intouutils:mainfrom
aguimaraes:date-fix-dst-abbreviation-offset
Feb 21, 2026
Merged

date: fix timezone abbreviations using wrong offset outside their DST season#11045
cakebaker merged 1 commit intouutils:mainfrom
aguimaraes:date-fix-dst-abbreviation-offset

Conversation

@aguimaraes
Copy link
Contributor

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 whatever
offset 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_MAPPINGS with FIXED_OFFSET_ABBREVIATIONS that
stores 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

@aguimaraes
Copy link
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.

@codspeed-hq
Copy link

codspeed-hq bot commented Feb 21, 2026

Merging this PR will improve performance by 8.91%

⚡ 2 improved benchmarks
✅ 286 untouched benchmarks
⏩ 40 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Memory file_tz_abbreviations 529.7 KB 509.2 KB +4.02%
Simulation file_tz_abbreviations 24.2 ms 22.2 ms +8.91%

Comparing aguimaraes:date-fix-dst-abbreviation-offset (3de5ab8) with main (a972eee)

Open in CodSpeed

Footnotes

  1. 40 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@github-actions
Copy link

GNU testsuite comparison:

Congrats! The gnu test tests/tail/tail-n0f is now passing!

@cakebaker cakebaker merged commit e4cc92b into uutils:main Feb 21, 2026
156 of 157 checks passed
@cakebaker
Copy link
Contributor

Thanks for your PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

date: MEZ is not recognized date: EDT/PDT give wrong offset when used outside their DST season

2 participants