Skip to content

Commit

Permalink
Merge branch '5.21' into 5.22
Browse files Browse the repository at this point in the history
  • Loading branch information
Davidmattei committed Dec 5, 2024
2 parents ee3fb8d + 092d3c0 commit f3224d0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions EMS/core-bundle/src/Form/DataField/TimeFieldType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit f3224d0

Please sign in to comment.