8000 Used second arg of DateTime to specify the timezone · symfony/symfony@784f308 · GitHub
[go: up one dir, main page]

Skip to content

Commit 784f308

Browse files
committed
Used second arg of DateTime to specify the timezone
1 parent 76223b2 commit 784f308

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public function reverseTransform($value)
126126

127127
try {
128128
// read timestamp into DateTime object - the formatter delivers in UTC
129-
$dateTime = new \DateTime(sprintf('@%s UTC', $timestamp));
129+
$dateTime = new \DateTime(sprintf('@%s', $timestamp), new \DateTimeZone('UTC');
130130
} catch (\Exception $e) {
131131
throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e);
132132
}

0 commit comments

Comments
 (0)
0