Skip to content

Commit

Permalink
fix: don't let the JS plugin to parse the ATOM date
Browse files Browse the repository at this point in the history
  • Loading branch information
theus77 committed Feb 16, 2024
1 parent 95b5d8a commit f76444c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion EMS/core-bundle/src/Form/DataField/DateTimeFieldType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit f76444c

Please sign in to comment.