Skip to content

Fix major incompatibility with tzdata 2026c (Morocco, Alberta Canada) - #178

Open
dyl-sv wants to merge 1 commit into
lau:masterfrom
freshaengineering:fix/morocco-2026c-permanent-utc
Open

Fix major incompatibility with tzdata 2026c (Morocco, Alberta Canada)#178
dyl-sv wants to merge 1 commit into
lau:masterfrom
freshaengineering:fix/morocco-2026c-permanent-utc

Conversation

@dyl-sv

@dyl-sv dyl-sv commented Aug 10, 2026

Copy link
Copy Markdown

Closes #177

PeriodBuilder assumed a zone line ended the moment its rules stopped, so it switched Morocco to permanent UTC in March instead of September. That dropped the +01 span from March to September: any instant in that window was reported as UTC — one hour off — for roughly six months.

The fix: when a zone line's rules run out but the line itself keeps going, hold the offset the last rule left in effect until the line's real end date, then move on to the next line. This only kicks in for lines with a fixed end date, so zones whose final line runs forever (and hand off to dynamically computed future periods) are unaffected.

The same mistake also affected historical transitions in a number of other zones. Verified against zdump: 78 previously-wrong transitions now match, with no regressions.

Credit: @kamilkowalski

Background on the data: the IANA time zone database describes each zone as
a stack of "zone lines". Each line covers a span of history — it gives the
base offset and which daylight-saving rules apply — and ends on a date
when the next line takes over. Importantly, the daylight-saving rules a
line points at can stop firing before the line's own end date.

In tzdata 2026c, Morocco switches to permanent UTC on 20 September 2026.
The zone line for Africa/Casablanca and Africa/El_Aaiun applies a +01 base
offset with Morocco's daylight-saving rules and runs until that September
switch. But those rules stop in March 2026, after the year's final Ramadan
adjustment — so the line has six months left to run with no more rules.

PeriodBuilder assumed a zone line ended the moment its rules stopped, so
it switched Morocco to permanent UTC in March instead of September. That
dropped the +01 span from March to September: any instant in that window
was reported as UTC — one hour off — for roughly six months.

The fix: when a zone line's rules run out but the line itself keeps going,
hold the offset the last rule left in effect until the line's real end
date, then move on to the next line. This only kicks in for lines with a
fixed end date, so zones whose final line runs forever (and hand off to
dynamically computed future periods) are unaffected.

The same mistake also affected historical transitions in a number of other
zones. Verified against zdump: 78 previously-wrong transitions now match,
with no regressions.
@dyl-sv dyl-sv changed the title Fix Morocco reported as UTC six months early in tzdata 2026c Fix major incompatibility with tzdata 2026c (Morocco, Alberta Canada) Aug 10, 2026
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.

Incorrectly applying Morocco 2026c update before official cutover

2 participants