Assume default timezone if not provided.

Data is coming from Germany and affects German places only.
We therefore expect German timezone.
This commit is contained in:
Daniel Siepmann 2021-08-31 08:16:48 +02:00
parent 265cb27236
commit 73db8b5d9d

View file

@ -71,12 +71,12 @@ class OpeningHour
{
$from = null;
if (isset($rawData['from'])) {
$timeZone = new \DateTimeZone($rawData['from']['timezone']);
$timeZone = new \DateTimeZone($rawData['from']['timezone'] ?? 'Europe/Berlin');
$from = new \DateTimeImmutable($rawData['from']['date'], $timeZone);
}
$through = null;
if (isset($rawData['through'])) {
$timeZone = new \DateTimeZone($rawData['through']['timezone']);
$timeZone = new \DateTimeZone($rawData['through']['timezone'] ?? 'Europe/Berlin');
$through = new \DateTimeImmutable($rawData['through']['date'], $timeZone);
}