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.
Issue
When unsing the library, we wanted to generate dates using the cron on a repeat (e.g. every 7 days with cron
0 0 */7 * *
), but, even though we set thestart_time
, the library just uses preset values to generate the possible dates.Code
A new parameter was added when creating a
croniter
instance -expand_from_start_time
. WhenTrue
, the expnaded values will be generated based on thestart_time
date set when creating the instance.Current behavior
0 0 */7 * *
, start time today (2024-07-11):get_next()
would generate 2024-07-15 (4 days from now) ❌New behavior
0 0 */7 * *
, start time today (2024-07-11):get_next()
would generate 2024-07-18 (7 days from now) ✅Important
Because the expanded values are generated when creating the
croniter
instance, usingexpand_from_start_time=True
and settingstart_time
on theget_next()
method is not supported.Changes
I made the initial changes, but wanted the opinion of the mantainers before moving forward with the changes.