Repository navigation
Conversation
When a zone line with named rules started, the period builder began with std_off 0 and only looked at rules from the zone line's own start year onward. If the rule set's last change was in an earlier year, it was ignored. zic uses that rule's save and letter at the start. For example America/Phoenix showed MST instead of MWT from 1944-04-01 to 1944-10-01, and Europe/Budapest showed CET instead of CEST from 1941-04-07 to 1942-11-02.
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.
When a zone line with named rules starts, the period builder starts with
std_off0 and only looks at rules from the zone line's own start year onward. If the rule set's last change was in an earlier year, that rule is lost, even though it is still in effect. zic uses that rule's save and letter at the start of the zone line.Example,
America/Phoenix:The last US rule before 1944 is the 1942 war time rule (save 1:00, letter W).
zdump -v -c 1944,1945 America/Phoenix:On master,
DateTime.shift_zone(~U[1944-04-01 08:01:00Z], "America/Phoenix", Tzdata.TimeZoneDatabase)gives MST, -07:00. It should be MWT, -06:00.Same bug, other zones:
Fix
In
calc_periods/5, for a zone line with named rules, find the last rule of that rule set that took effect in a year before the zone line starts. If there is one, start the zone line with its save and letter. Rules in the start year itself were already handled.Test
New test in
test/tz_period_builder_test.exschecks the 1944 MWT period of America/Phoenix and the 1941-1942 CEST period of Europe/Budapest againstzdump.mix test test/tz_period_builder_test.exs-> 18/19 passed (new test fails: got "MST", want "MWT").mix format --check-formattedandmix compile --warnings-as-errorsare clean.I also compared all zones (tzdata 2026d source) with the system zoneinfo, at every transition ±1 s from 1900 to 2060. Mismatches went from 150 to 91, and no new ones showed up. The rest are other cases (for example 1 hour of CST instead of CDT in America/Indiana/Knox on 2006-04-02, where a zone line ends at the same wall time a rule fires) and release differences, not this bug.