fix: do not skip midnight after daylight saving starts - #221
Open
punjabik wants to merge 1 commit into
Open
Conversation
When an offset change makes the fixed target-hour distance negative, prefixing it with a plus sign produces a modifier such as "+-1 hours". PHP interprets that as a positive interval, so getNextRunDate() advances past the next valid midnight. Pass the signed distance unchanged and cover the spring transition with a regression test.
punjabik
marked this pull request as draft
August 4, 2026 07:55
punjabik
marked this pull request as ready for review
August 4, 2026 07:56
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.
Summary
Problem
When a spring DST offset change makes the calculated target-hour distance negative, the forward path prefixes it with another plus sign. A distance of
-1therefore becomes the modifier"+-1 hours", which PHP interprets as a positive one-hour interval.For
0 0 * * *inEurope/Prague, starting at2026-03-29 00:30:00 +01:00, this leaves the candidate at 01:00 instead of midnight. The next iteration then advances to March 31 and skips the valid March 30 midnight occurrence.Passing the already signed distance unchanged produces
"-1 hours"and keeps positive distances valid as well.This is a remaining edge case related to #154, #202, and #203.
Tests
composer test- 176 tests, 803 assertions, 4 skippedcomposer phpstan- no errorsFixes #220