Skip to content

Commit

Permalink
Patch Date::createFromFormat() to work around https://bugs.php.net/bu…
Browse files Browse the repository at this point in the history
  • Loading branch information
othercorey committed Aug 22, 2020
1 parent 63d5696 commit 2ec6bd6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Traits/FactoryTrait.php
Expand Up @@ -239,11 +239,11 @@ public static function createFromFormat($format, $time, $tz = null): ChronosInte
}

$errors = parent::getLastErrors();
if ($dt == false) {
if (!$dt) {
throw new InvalidArgumentException(implode(PHP_EOL, $errors['errors']));
}

$dt = static::instance($dt);
$dt = new static($dt->format('Y-m-d H:i:s.u'), $dt->getTimezone());
static::$_lastErrors = $errors;

return $dt;
Expand Down

0 comments on commit 2ec6bd6

Please sign in to comment.