Skip to content

Commit

Permalink
IBX-801: Fixed timezone for DateTime fields in content name pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
SerheyDolgushev committed Jul 21, 2021
1 parent 9cedd02 commit eed4480
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion eZ/Publish/Core/FieldType/DateAndTime/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use eZ\Publish\SPI\FieldType\Value as SPIValue;
use DateInterval;
use DateTime;
use DateTimeZone;

class Type extends FieldType
{
Expand Down Expand Up @@ -63,7 +64,10 @@ public function getName(SPIValue $value, FieldDefinition $fieldDefinition, strin
return '';
}

return $value->value->format('D Y-d-m H:i:s');
$dt = $value->value;
$dt->setTimezone(new DateTimeZone(date_default_timezone_get()));

return $dt->format('D Y-d-m H:i:s');
}

/**
Expand Down

0 comments on commit eed4480

Please sign in to comment.