Fix error spam in logs due to missing cron month

This commit is contained in:
Dane Everitt 2021-03-21 10:49:23 -07:00
parent 8c7d785c9e
commit aa0b7977bb
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
2 changed files with 33 additions and 1 deletions

View file

@ -122,13 +122,14 @@ class Schedule extends Model
* Returns the schedule's execution crontab entry as a string.
*
* @return \Carbon\CarbonImmutable
* @throws \Exception
*/
public function getNextRunDate()
{
$formatted = sprintf('%s %s %s %s %s', $this->cron_minute, $this->cron_hour, $this->cron_day_of_month, $this->cron_month, $this->cron_day_of_week);
return CarbonImmutable::createFromTimestamp(
CronExpression::factory($formatted)->getNextRunDate()->getTimestamp()
(new CronExpression($formatted))->getNextRunDate()->getTimestamp()
);
}