8000 fixed timezone bug in DateTimeToTimestampTransformer · fixe/symfony@17c3482 · GitHub
[go: up one dir, main page]

Skip to content

Commit 17c3482

Browse files
committed
fixed timezone bug in DateTimeToTimestampTransformer
1 parent b062cc7 commit 17c3482

File tree

1 file changed

+3
-1
li CC9D nes changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ public function reverseTransform($value)
7373
}
7474

7575
try {
76-
$dateTime = new \DateTime(sprintf("@%s %s", $value, $this->outputTimezone));
76+
$dateTime = new \DateTime();
77+
$dateTime->setTimezone(new \DateTimeZone($this->outputTimezone));
78+
$dateTime->setTimestamp($value);
7779

7880
if ($this->inputTimezone !== $this->outputTimezone) {
7981
$dateTime->setTimezone(new \DateTimeZone($this->inputTimezone));

0 commit comments

Comments
 (0)
0