Skip to content

Commit

Permalink
Merge pull request #29 from PhantPHP/Fix-Date-/-DateTime
Browse files Browse the repository at this point in the history
Fix date and dateime
  • Loading branch information
lennyrouanet authored Feb 22, 2024
2 parents f99a8c4 + 4f6cbf7 commit 5840bf1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion component/Time/Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ public function __construct(
}

$time = is_string($date) ? strtotime($date) : $date;
$time = (new \DateTime())->setTimestamp($time)->setTime(0, 0)->getTimestamp();

if (get_class($this) == self::class) {
$time = (new \DateTime())->setTimestamp($time)->setTime(0, 0)->getTimestamp();
}

if ($time === false) {
throw new NotCompliant('Date: ' . $date);
Expand Down

0 comments on commit 5840bf1

Please sign in to comment.