fixes #693: never select a default date before first existing shift in shifts view

This commit is contained in:
msquare 2020-04-03 10:28:55 +02:00
parent 6fb6c9bc25
commit fbd78b8daf
1 changed files with 6 additions and 1 deletions

View File

@ -47,7 +47,12 @@ 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)) {
$start_time = time(); $first_day = DateTime::createFromFormat('Y-m-d', $days[0])->getTimestamp();
if(time() < $first_day) {
$start_time = $first_day;
} else {
$start_time = time();
}
} }
$end_time = $shiftsFilter->getEndTime(); $end_time = $shiftsFilter->getEndTime();