Skip to content
This repository was archived by the owner on Jan 31, 2020. It is now read-only.

Commit 8285a1c

Browse files
committed
fix: fixes issues with Moscow winter time
Instead of using the internal timezone when converting a string value to a DateTime value, use UTC. This solves issues with Moscow winter time, while allowing existing tests to continue passing, and is more equivalent to the custom week format support, which does not use a timezone. Fixes #257
1 parent 8d9eb43 commit 8285a1c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/DateStep.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,10 @@ protected function convertString($value, $addErrors = true)
166166
if (strpos($this->format, 'Y-\WW') === 0
167167
&& preg_match('/^([0-9]{4})\-W([0-9]{2})/', $value, $matches)
168168
) {
169-
$date = new DateTime;
169+
$date = new DateTime();
170170
$date->setISODate($matches[1], $matches[2]);
171171
} else {
172-
$date = DateTime::createFromFormat($this->format, $value, $this->timezone);
172+
$date = DateTime::createFromFormat($this->format, $value, new DateTimeZone('UTC'));
173173
}
174174

175175
// Invalid dates can show up as warnings (ie. "2007-02-99")

0 commit comments

Comments
 (0)