task schedule: fix end-of-month validation bug #23329
Merged
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.
Fix erroneous "end cannot be sooner than start" error condition on the last day of the month.
By building "
next end
fromfrom
" instead of "next end
fromnext start
" (we actually use the latter for the schedule), on the last day of any given month, the nextstart.Day()
would be1
(the first of the next month), which is less than the currentend.Day()
-- whatever the last day of the month is,28-31
-- so it would mistakenly think the user provided improper values. (I'm sorry, this is really hard to put into plain language... hopefully the code makes sense.)I happened to be starting some e2e testing (not present in this PR) at the end of May and bumped into this, so formalize with a unit test case, and also include Fuzz testing to try and catch other possible unforeseen gotchas (I got it to catch this one, but fortunately(?) it did not foresee any more).
Fixes #23159