From 092d3c0bd3a24dc5ac1fd3f348cf389785266423 Mon Sep 17 00:00:00 2001 From: Mathieu De Keyzer Date: Thu, 5 Dec 2024 14:36:44 +0100 Subject: [PATCH] fix(admin/field): deep recompute time field type (#1094) --- EMS/core-bundle/src/Form/DataField/TimeFieldType.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/EMS/core-bundle/src/Form/DataField/TimeFieldType.php b/EMS/core-bundle/src/Form/DataField/TimeFieldType.php index 657b3f865..5662aedcb 100644 --- a/EMS/core-bundle/src/Form/DataField/TimeFieldType.php +++ b/EMS/core-bundle/src/Form/DataField/TimeFieldType.php @@ -106,8 +106,11 @@ public function reverseViewTransform($data, FieldType $fieldType): DataField { $format = static::getFormat($fieldType->getOptions()); $converted = !\is_array($data) ? \DateTime::createFromFormat($format, \strval($data)) : false; + $convertedFromStoreFormat = !\is_array($data) ? \DateTime::createFromFormat($this::STOREFORMAT, \strval($data)) : false; if ($converted) { $out = $converted->format($this::STOREFORMAT); + } elseif ($convertedFromStoreFormat) { + $out = $convertedFromStoreFormat->format($this::STOREFORMAT); } else { $out = null; }