mirror of https://github.com/joomla/joomla-cms.git
[4.4] Determine the next task run date with the timezone of the site (#43259)
* Determine the next task run date with the timezone of the site * cs ---------
This commit is contained in:
parent
079047c366
commit
d1bef331ea
|
@ -104,7 +104,8 @@ class ExecRuleHelper
|
|||
case 'cron-expression':
|
||||
// @todo: testing
|
||||
$cExp = new CronExpression((string) $this->rule->exp);
|
||||
$nextExec = $cExp->getNextRunDate('now', 0, false, 'UTC');
|
||||
$nextExec = $cExp->getNextRunDate('now', 0, false, Factory::getApplication()->get('offset', 'UTC'));
|
||||
$nextExec->setTimezone(new \DateTimeZone('UTC'));
|
||||
$nextExec = $string ? $this->dateTimeToSql($nextExec) : $nextExec;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -283,6 +283,18 @@ class TaskModel extends AdminModel
|
|||
$data->execution_rules['exec-day'] = gmdate('d');
|
||||
$data->execution_rules['exec-time'] = gmdate('H:i');
|
||||
}
|
||||
|
||||
if ($data->next_execution) {
|
||||
$data->next_execution = Factory::getDate($data->next_execution);
|
||||
$data->next_execution->setTimezone(new \DateTimeZone($this->app->get('offset', 'UTC')));
|
||||
$data->next_execution = $data->next_execution->toSql(true);
|
||||
}
|
||||
|
||||
if ($data->last_execution) {
|
||||
$data->last_execution = Factory::getDate($data->last_execution);
|
||||
$data->last_execution->setTimezone(new \DateTimeZone($this->app->get('offset', 'UTC')));
|
||||
$data->last_execution = $data->last_execution->toSql(true);
|
||||
}
|
||||
}
|
||||
|
||||
// Let plugins manipulate the data
|
||||
|
|
Loading…
Reference in New Issue