Skip to content

[9.] Update cron expression #35984

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

Merged
merged 1 commit into from
Jan 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"ext-mbstring": "*",
"ext-openssl": "*",
"doctrine/inflector": "^1.4|^2.0",
"dragonmantank/cron-expression": "^3.0.2",
"dragonmantank/cron-expression": "^3.1",
"egulias/email-validator": "^2.1.10",
"league/commonmark": "^1.3",
"league/flysystem": "^2.0",
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Console/Scheduling/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ protected function expressionPasses()
$date->setTimezone($this->timezone);
}

return CronExpression::factory($this->expression)->isDue($date->toDateTimeString());
return (new CronExpression($this->expression))->isDue($date->toDateTimeString());
}

/**
Expand Down
5 changes: 4 additions & 1 deletion src/Illuminate/Console/Scheduling/ScheduleListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Illuminate\Console\Scheduling;

use Cron\CronExpression;
use DateTimeZone;
use Illuminate\Console\Command;
use Illuminate\Support\Carbon;

Expand Down Expand Up @@ -47,7 +48,9 @@ public function handle(Schedule $schedule)
$event->description,
(new CronExpression($event->expression))
->getNextRunDate(Carbon::now())
->setTimezone($this->option('timezone', config('app.timezone'))),
->setTimezone(
new DateTimeZone($this->option('timezone') ?? config('app.timezone'))
),
];
}

Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Console/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
}
},
"suggest": {
"dragonmantank/cron-expression": "Required to use scheduler (^3.0.2).",
"dragonmantank/cron-expression": "Required to use scheduler (^3.1).",
"guzzlehttp/guzzle": "Required to use the ping methods on schedules (^7.2).",
"illuminate/bus": "Required to use the scheduled job dispatcher (^9.0).",
"illuminate/container": "Required to use the scheduler (^9.0).",
Expand Down