fix timezone problem
This commit is contained in:
@@ -70,6 +70,9 @@ class CarbonHandler implements SubscribingHandlerInterface
|
||||
*/
|
||||
public function serializeCarbon(VisitorInterface $visitor, Carbon $date, array $type, Context $context)
|
||||
{
|
||||
$date = clone $date;
|
||||
$date->setTimezone($this->defaultTimezone);
|
||||
|
||||
return $visitor->visitString($date->format($this->getFormat($type)), $type, $context);
|
||||
}
|
||||
|
||||
@@ -94,6 +97,8 @@ class CarbonHandler implements SubscribingHandlerInterface
|
||||
throw new RuntimeException(sprintf('Invalid datetime "%s", expected format %s.', $data, $format));
|
||||
}
|
||||
|
||||
$datetime->setTimezone(new \DateTimeZone(date_default_timezone_get()));
|
||||
|
||||
return $datetime;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user