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

main
msquare 5 years ago
parent 6fb6c9bc25
commit fbd78b8daf

@ -47,8 +47,13 @@ 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();
if(time() < $first_day) {
$start_time = $first_day;
} else {
$start_time = time(); $start_time = time();
} }
}
$end_time = $shiftsFilter->getEndTime(); $end_time = $shiftsFilter->getEndTime();
if ($end_time == null) { if ($end_time == null) {

Loading…
Cancel
Save