Skip to content

Commit

Permalink
Update DateTimeTrait.php
Browse files Browse the repository at this point in the history
  • Loading branch information
liborm85 committed May 12, 2023
1 parent f3d7ae7 commit f4eec2f
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/Context/DateTimeTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@ private function unixTimeToDateTime(?float $microtime): ?\DateTimeImmutable
}

$datetime = \DateTimeImmutable::createFromFormat('U.u', number_format($microtime, 6, '.', '')) ?: null;
if ($datetime === null) {
return null;
}

return $datetime->setTimezone(new \DateTimeZone(date_default_timezone_get()));
return $datetime?->setTimezone(new \DateTimeZone(date_default_timezone_get()));
}

}

0 comments on commit f4eec2f

Please sign in to comment.