| Conditions | 2 |
| Paths | 2 |
| Total Lines | 22 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 27 | public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) |
||
| 28 | { |
||
| 29 | // save configured timezone |
||
| 30 | $timezone = date_default_timezone_get(); |
||
| 31 | // set timezone to UTC |
||
| 32 | date_default_timezone_set('UTC'); |
||
| 33 | |||
| 34 | $date = $arguments['date']; |
||
| 35 | if ($date instanceof \DateTimeInterface) { |
||
| 36 | $renderChildrenClosure = function () use ($date) { |
||
| 37 | // Convert date to timestamp, so that it can be reparsed. |
||
| 38 | return $date->getTimestamp(); |
||
| 39 | }; |
||
| 40 | } |
||
| 41 | |||
| 42 | $result = parent::renderStatic($arguments, $renderChildrenClosure, $renderingContext); |
||
| 43 | |||
| 44 | // restore timezone setting |
||
| 45 | date_default_timezone_set($timezone); |
||
| 46 | |||
| 47 | return $result; |
||
| 48 | } |
||
| 49 | } |
||
| 50 |