Repository navigation
Compare the UTC UNTIL of VTIMEZONE rules in UTC - #111
Merged
Merged
Conversation
TimezoneGuesser expanded observance rules with local times read as UTC, but UNTIL is in UTC (RFC 5545, section 3.3.10). East of UTC the last transition of a rule that ended was dropped, so e.g. Europe/Moscow before 2011 under a non-IANA TZID did not resolve; west of UTC a transition after UNTIL could be kept. Rules are now expanded in the fixed TZOFFSETFROM offset, which gives UTC timestamps. Across all PHP timezones and three ranges, definitions from VTimezoneBuilder under a renamed TZID now resolve to the same transitions (203 of 5028 cases failed before). Closes #110
…ances The fixed-offset zone rounded local mean time offsets like +001932 to minutes, so every transition was off by the rounding and no IANA timezone matched (e.g. Europe/Amsterdam 1934-1940). PHP timezones keep seconds. Refs #110
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.
Closes #110
TimezoneGuesser::transitions()expanded observance rules with local times read as UTC, but UNTIL is in UTC (RFC 5545, section 3.3.10). East of UTC the last transition of a rule that ended was dropped, so e.g. Europe/Moscow before 2011 under a non-IANA TZID did not resolve; west of UTC a transition after UNTIL could be kept and match a wrong zone.Rules (and RDATEs, DTSTART) are now expanded in a fixed-offset zone of TZOFFSETFROM, so the Expander returns UTC timestamps and compares UNTIL correctly.
Tests
resolvers.phpt: a hand-written Europe/Moscow 2008–2013 definition underCustom/Moscowresolves for reference dates 2010 and 2011 with the right offsets; a west-of-UTC definition whose daylight rule ends before its 2010 transition is no longer matched to America/New_York. Both fail without the fix.vtimezone-builder.phpt: definitions fromVTimezoneBuilderwith UNTIL (Europe/Moscow, Europe/Minsk, America/Sao_Paulo, Europe/Istanbul) under a renamed TZID resolve to the same transitions as PHP for every reference year.composer checkpasses; golden fixtures unchanged.