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

Schedule due times doesn't take ->between() into account #51107

Closed
skywarth opened this issue Apr 17, 2024 · 1 comment
Closed

Schedule due times doesn't take ->between() into account #51107

skywarth opened this issue Apr 17, 2024 · 1 comment

Comments

@skywarth
Copy link

skywarth commented Apr 17, 2024

Laravel Version

8.83

PHP Version

7.4

Database Driver & Version

N/A

Description

I was preparing some schedule tests for my Laravel package when I encountered the issue. I've noticed that neither ->isDue() or ->nextRunDate() takes ->between() statements (which are essentially ->when()) into account when determining schedules due time.

Steps To Reproduce

Following is the code snippet how I noticed the issue. I'm not sure if this is intended behavior or its missing something. Because for me, it doesn't make sense that ->isDue() or ->nextRunDate() doesn't take ->when() or ->between() statements into account. After all, you designate some time frame in the ->between().

$minTime='08:00';
$maxTime='18:00';
$mock=Carbon::createFromDate(2024,04,15)->setTime(04,15);
Carbon::setTestNow($mock);
$this->travelTo($mock);//redundant
$x=new Schedule();
$schedule=$x->command('test')->weekdays()->everyFiveMinutes()->between($minTime,$maxTime); //notice the ->between()
dump($schedule->nextRunDate($mock)->format('d-m-Y H:i')); //Outputs: "15-04-2024 04:20", expected: "15-04-2024 08:00"
dd($schedule->isDue(app())); //Outputs: true, expected: false
@crynobone
Copy link
Member

Duplicate of #50670

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants