Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getNextRunDate false on Daily frequency type (every x days) #1

Open
Creeall opened this issue Apr 15, 2023 · 0 comments
Open

getNextRunDate false on Daily frequency type (every x days) #1

Creeall opened this issue Apr 15, 2023 · 0 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@Creeall
Copy link

Creeall commented Apr 15, 2023

Hi, I was trying to have a script finding the next run date from this setup :

$xdays = 3;
$period = $generator->dailyAt(
$dateTime->format("H"),
$dateTime->format("i")
)->set(new \Butschster\CronExpression\Parts\Days\EveryDay($xdays))->getExpression();

this produice the cron : [46 13 */3 * *]

The goal is to get let's say we are 2023-04-10 13:46
and $xdays = 3
then next run = 2023-04-13 13:46
next is 2023-04-16 10:05:16…

But the result is not al all correct. So maybe the setup is wrong to have the lib recognize the "every x 'number of' days" ?
The cron code is right though so I don't really underdand why it's failing.

This is a json result of the same setup looping $xdays from 1 to 9 to check the different 'next run date' :
From the today date 2023-04-15 14:06
I was expecting dates to be the 16 (every 1 day), the 17 (every 2 days), the 18 (every 3 days), etc.

{"1":{"cron":"6 14 *\/1 * *","next":"18\/04\/2023 14:06:00"},"2":{"cron":"6 14 *\/2 * *","next":"21\/04\/2023 14:06:00"},"3":{"cron":"6 14 *\/3 * *","next":"22\/04\/2023 14:06:00"},"4":{"cron":"6 14 *\/4 * *","next":"25\/04\/2023 14:06:00"},"5":{"cron":"6 14 *\/5 * *","next":"26\/04\/2023 14:06:00"},"6":{"cron":"6 14 *\/6 * *","next":"01\/05\/2023 14:06:00"},"7":{"cron":"6 14 *\/7 * *","next":"01\/05\/2023 14:06:00"},"8":{"cron":"6 14 *\/8 * *","next":"01\/05\/2023 14:06:00"},"9":{"cron":"6 14 *\/9 * *","next":"01\/05\/2023 14:06:00"}}

@butschster butschster self-assigned this Apr 17, 2023
@butschster butschster added the help wanted Extra attention is needed label Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants