From 68dd73e333061b3ff0814be16951b6411ca79146 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Wed, 30 Aug 2023 16:56:15 +0200 Subject: [PATCH] Shifts creation: Fix start/end date value after going back --- includes/pages/admin_shifts.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/includes/pages/admin_shifts.php b/includes/pages/admin_shifts.php index 3f760d7b..3259ea1d 100644 --- a/includes/pages/admin_shifts.php +++ b/includes/pages/admin_shifts.php @@ -368,8 +368,8 @@ function admin_shifts() form_hidden('description', $description), form_hidden('title', $title), form_hidden('rid', $rid), - form_hidden('start', $start->format('Y-m-d H:i')), - form_hidden('end', $end->format('Y-m-d H:i')), + form_hidden('start', $request->input('start')), + form_hidden('end', $request->input('end')), form_hidden('mode', $mode), form_hidden('length', $length), form_hidden('change_hours', implode(', ', $change_hours)), @@ -477,10 +477,22 @@ function admin_shifts() div('col-md-6 col-xl-5', [ div('row', [ div('col-lg-6', [ - form_datetime('start', __('Start'), $start), + form_datetime( + 'start', + __('Start'), + $request->has('start') + ? Carbon::createFromDatetime($request->input('start')) + : $start + ), ]), div('col-lg-6', [ - form_datetime('end', __('End'), $end), + form_datetime( + 'end', + __('End'), + $request->has('end') + ? Carbon::createFromDatetime($request->input('end')) + : $end + ), ]), ]), form_info(__('Mode')),