Skip to content

Commit

Permalink
fixed the bug with comparaison
Browse files Browse the repository at this point in the history
  • Loading branch information
Kharhamel committed Jan 6, 2020
1 parent 24bf4d3 commit efc05a2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/DateTimeImmutable.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ class DateTimeImmutable extends \DateTimeImmutable
*/
public function __construct($time = 'now', $timezone = null)
{
parent::__construct();
parent::__construct($time, $timezone);
$this->innerDateTime = new parent($time, $timezone);
}

//switch from regular datetime to safe version
private static function createFromRegular(\DateTimeImmutable $datetime): self
{
$safeDatetime = new self();
$safeDatetime = new self($datetime->format('Y-m-d H:i:s'), $datetime->getTimezone()); //we need to also update the wrapper to not break the operators '<' and '>'
$safeDatetime->innerDateTime = $datetime;
return $safeDatetime;
}
Expand Down

0 comments on commit efc05a2

Please # to comment.