From fbd78b8daf51b74677f58a087e3282235f44e82d Mon Sep 17 00:00:00 2001 From: msquare Date: Fri, 3 Apr 2020 10:28:55 +0200 Subject: [PATCH] fixes #693: never select a default date before first existing shift in shifts view --- includes/pages/user_shifts.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php index b4acd2de..10e57194 100644 --- a/includes/pages/user_shifts.php +++ b/includes/pages/user_shifts.php @@ -47,7 +47,12 @@ function update_ShiftsFilter_timerange(ShiftsFilter $shiftsFilter, $days) { $start_time = $shiftsFilter->getStartTime(); 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();