Skip to content

Commit

Permalink
Merge pull request #42 from Icinga/fix-serialized-datetime-format
Browse files Browse the repository at this point in the history
Include timezone name in serialized datetime format
  • Loading branch information
nilmerg authored May 12, 2023
2 parents d0fa442 + 2f2ab24 commit 4afe82c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Contract/Frequency.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
interface Frequency extends JsonSerializable
{
/** @var string Format for representing datetimes when serializing the frequency to JSON */
public const SERIALIZED_DATETIME_FORMAT = 'Y-m-d\TH:i:s.uP';
public const SERIALIZED_DATETIME_FORMAT = 'Y-m-d\TH:i:s.ue';

/**
* Get whether the frequency is due at the specified time
Expand Down
4 changes: 1 addition & 3 deletions src/RRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,7 @@ public function jsonSerialize(): array

$start = $this->getStart();
if ($start) {
$data['start'] = (clone $start)
->setTimezone(new DateTimeZone('UTC'))
->format(static::SERIALIZED_DATETIME_FORMAT);
$data['start'] = $start->format(static::SERIALIZED_DATETIME_FORMAT);
}

return $data;
Expand Down

0 comments on commit 4afe82c

Please sign in to comment.