Skip to content

Commit

Permalink
Merge pull request concretecms#12389 from hissy/fix/schedule-list-tim…
Browse files Browse the repository at this point in the history
…ezone

Show scheduled times of automated tasks in system timezone
  • Loading branch information
aembler authored Jan 9, 2025
2 parents 6d535a6 + a269028 commit 6877928
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions concrete/src/Entity/Command/ScheduledTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,9 @@ public function getCronExpressionObject(): CronExpression
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
$timezone = date_default_timezone_get();
$dateScheduledString = (new \DateTime('@' . $this->getDateScheduled()))
->setTimezone(new \DateTimeZone($timezone))
->format('F d, Y g:i a');

/** @var \Concrete\Core\Localization\Service\Date $date */
$date = app('helper/date');
$dateScheduledString = $date->formatPrettyDateTime($this->getDateScheduled());
$cronExpression = $this->getCronExpressionObject();

$data = [
Expand All @@ -159,7 +157,7 @@ public function jsonSerialize()
'dateScheduled' => $this->getDateScheduled(),
'dateScheduledString' => $dateScheduledString,
'cronExpression' => $this->getCronExpression(),
'nextRunDate' => $cronExpression->getNextRunDate()->format('Y-m-d H:i:s'),
'nextRunDate' => $date->formatPrettyDateTime($cronExpression->getNextRunDate()),
'user' => $this->getUser(),
];
return $data;
Expand Down

0 comments on commit 6877928

Please sign in to comment.