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];