فهرست منبع

Wrapped DateTimeZone object around the timezone

Wrapped DateTimeZone object around the timezone when using the DateTime type.
colinmorelli 12 سال پیش
والد
کامیت
bd2d0eaaca
1فایلهای تغییر یافته به همراه1 افزوده شده و 1 حذف شده
  1. 1 1
      src/JMS/Serializer/Handler/DateHandler.php

+ 1 - 1
src/JMS/Serializer/Handler/DateHandler.php

@@ -98,7 +98,7 @@ class DateHandler implements SubscribingHandlerInterface
 
     private function parseDateTime($data, array $type)
     {
-        $timezone = isset($type['params'][1]) ? $type['params'][1] : $this->defaultTimezone;
+        $timezone = isset($type['params'][1]) ? new \DateTimeZone($type['params'][1]) : $this->defaultTimezone;
         $format = $this->getFormat($type);
         $datetime = \DateTime::createFromFormat($format, (string) $data, $timezone);
         if (false === $datetime) {