Allow null value during decoding of datetimes when time traveling

This should fix some exceptions occuring when viewing historic states of a part.
This commit is contained in:
Jan Böhmer 2022-10-09 20:52:52 +02:00
parent 9adebc35c5
commit 04d89b38b2

View file

@ -178,8 +178,13 @@ class TimeTravel
* @return DateTime
* @throws Exception
*/
private function dateTimeDecode(array $input): \DateTime
private function dateTimeDecode(?array $input): ?\DateTime
{
//Allow null values
if ($input === null) {
return null;
}
return new \DateTime($input['date'], new \DateTimeZone($input['timezone']));
}