From f76444cc1475666fe52d9f0278c1a63dc9876b17 Mon Sep 17 00:00:00 2001 From: Mathieu De Keyzer Date: Fri, 16 Feb 2024 11:09:18 +0100 Subject: [PATCH] fix: don't let the JS plugin to parse the ATOM date --- EMS/core-bundle/src/Form/DataField/DateTimeFieldType.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/EMS/core-bundle/src/Form/DataField/DateTimeFieldType.php b/EMS/core-bundle/src/Form/DataField/DateTimeFieldType.php index 0cc332a52..21b1c8081 100644 --- a/EMS/core-bundle/src/Form/DataField/DateTimeFieldType.php +++ b/EMS/core-bundle/src/Form/DataField/DateTimeFieldType.php @@ -103,7 +103,9 @@ public function viewTransform(DataField $dataField) if (\is_string($data) && '' !== $data) { $dateTime = \DateTimeImmutable::createFromFormat(\DateTimeImmutable::ATOM, $data); - $value = $dateTime ? $dateTime->format(\DateTimeImmutable::ATOM) : null; + $fieldType = $dataField->getFieldType(); + $parseFormat = (null !== $fieldType) ? $fieldType->getDisplayOption('parseFormat') : null; + $value = $dateTime ? $dateTime->format($parseFormat ?? \DateTimeImmutable::ATOM) : null; } return ['value' => $value];