mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-25 03:08:51 +02: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:
parent
9adebc35c5
commit
04d89b38b2
1 changed files with 6 additions and 1 deletions
|
@ -178,8 +178,13 @@ class TimeTravel
|
||||||
* @return DateTime
|
* @return DateTime
|
||||||
* @throws Exception
|
* @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']));
|
return new \DateTime($input['date'], new \DateTimeZone($input['timezone']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue