Fixes #824: Server error when no shifts configured and with 'user_shifts' as home site

This commit is contained in:
Igor Scheller 2021-10-08 15:38:58 +02:00 committed by msquare
parent ac9aa2169a
commit a68c8ae6d2
1 changed files with 4 additions and 1 deletions

View File

@ -49,7 +49,10 @@ function update_ShiftsFilter_timerange(ShiftsFilter $shiftsFilter, $days)
{ {
$start_time = $shiftsFilter->getStartTime(); $start_time = $shiftsFilter->getStartTime();
if (is_null($start_time)) { if (is_null($start_time)) {
$first_day = DateTime::createFromFormat('Y-m-d', $days[0])->getTimestamp(); $first_day = DateTime::createFromFormat(
'Y-m-d',
$days[0] ?? (new DateTime())->format('Y-m-d')
)->getTimestamp();
if(time() < $first_day) { if(time() < $first_day) {
$start_time = $first_day; $start_time = $first_day;
} else { } else {