Skip to content

Commit

Permalink
Update ConvertDateTimeProperty.php
Browse files Browse the repository at this point in the history
  • Loading branch information
safaksaylam committed May 28, 2023
1 parent 861e74d commit ee8fc01
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Model/ConvertDateTimeProperty.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ConvertDateTimeProperty implements ConvertPropertyInterface
{
use PropertyAccessorTrait;

public function __construct(public string $property, public string $format = \DateTimeInterface::ISO8601)
public function __construct(public string $property, public string $format = \DateTimeInterface::ISO8601, public ?string $timezone = null)
{
}

Expand All @@ -26,7 +26,7 @@ public function convert(array $arr): array
}
$strValue = $accessor->getValue($arr, $property);
if (\is_string($strValue)) {
$value = \DateTime::createFromFormat($this->format, $strValue);
$value = \DateTime::createFromFormat($this->format, $strValue, $this->timezone);
$accessor->setValue($arr, $property, $value);
}

Expand Down

0 comments on commit ee8fc01

Please sign in to comment.