fix timezone initialization from DateTime or Carbon object
This commit is contained in:
1 parent
313159a0fc
commit
84b7bf87a1
1 file changed
+5
-1
@@ -31,7 +31,11 @@ trait Creator
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
parent::__construct($dt, static::createTimeZone($timezone));
|
$tz = static::createTimeZone($timezone);
|
||||||
|
parent::__construct($dt, $tz);
|
||||||
|
if ($datetime instanceof DateTime) {
|
||||||
|
parent::setTimezone($tz);
|
||||||
|
}
|
||||||
self::loadMessages();
|
self::loadMessages();
|
||||||
} catch (Exception $exception) {
|
} catch (Exception $exception) {
|
||||||
throw new InvalidArgumentException(sprintf("Unknown datetime '%s'", $datetime));
|
throw new InvalidArgumentException(sprintf("Unknown datetime '%s'", $datetime));
|
||||||
|
|||||||
Reference in new issue
Block a user