Skip to content

Commit

Permalink
Fix DateType not clearing time for DateTimeImmutable
Browse files Browse the repository at this point in the history
  • Loading branch information
othercorey committed Sep 29, 2021
1 parent ffa65ce commit cf62812
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Database/Type/DateType.php
Expand Up @@ -81,10 +81,10 @@ public function useMutable()
public function marshal($value): ?DateTimeInterface
{
$date = parent::marshal($value);
/** @psalm-var \DateTime|\DateTimeImmutable $date */
if ($date && !$date instanceof I18nDateTimeInterface) {
// Clear time manually when I18n types aren't available and raw DateTime used
/** @psalm-var \DateTime|\DateTimeImmutable $date */
$date->setTime(0, 0, 0);
$date = $date->setTime(0, 0, 0);
}

return $date;
Expand Down

0 comments on commit cf62812

Please sign in to comment.