Repository navigation
fix(walk): start the day at 1am when dst skips midnight - #482
Merged
spencermountain merged 1 commit intoOct 31, 2026
Merged
Conversation
In zones where dst starts at 12am (Havana, Santiago, Cairo, Beirut,
the Azores), walking the hour down to 0 stepped into the previous day,
so walk() gave up and left the time where it was:
spacetime('2026-03-08T12:00:00', 'America/Havana').startOf('day')
// 2026-03-08T12:00:00.000-04:00
and endOf('day') on the day before ran on to noon the next day. When
the target is skipped, count to it from the clock time before the gap,
so 12am lands on 1am (and 12:17am on 1:17am).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Owner
|
thank you! |
Merged
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.
In zones where dst starts at 12am (Havana, Santiago, Cairo, Beirut, the Azores), walking the hour down to 0 stepped into the previous day, so walk() gave up and left the time where it was:
When the target is skipped, it now counts from the clock time before the gap, so 12am lands on 1am and 12:17am on 1:17am. That also fixes add(1, 'day') from 12:17am the day before, which gave 12:17pm. I compared startOf/endOf/add/hour/minute results for every zone before and after: only those midnight-gap days change, and half-hour gaps like Lord Howe come out the same as before. Tests added to tests/dst/transition-setters.test.js, pinned to the 2026 rules; they fail on master and pass with the change. The full suite and the plugin suites pass.
I used Claude Code to write this change.