mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-03-03 05:55:16 +01:00
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:
@@ -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']));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user