From e018f86de325acbd8ebc89a8e2b956a0261895ce Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 3 Oct 2023 08:07:10 +0100 Subject: [PATCH] Bug 29002: Fix async bookings load issues This patch updates the modal booking form to only fire the ajax request upon first modal opening and then moves the data related setup into a function that can be trigger either upon promise resolution or immediately if the data already exists at the time the modal is opened. We also update some instances of datetime processing to use dayjs endOf('day') function as it appears to work more reliably with timezone maths that our prior work that used direct mathematical manipulations. Signed-off-by: Martin Renvoize Signed-off-by: Janet McGowan Signed-off-by: Caroline Cyr La Rose Signed-off-by: Laurence Rault Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- .../prog/en/modules/bookings/list.tt | 9 +- .../prog/js/place_booking_modal.js | 559 ++++++++++-------- 2 files changed, 300 insertions(+), 268 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt index c523dfd632..4ae9e71da5 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt @@ -152,13 +152,10 @@ // action events onMove: function (data, callback) { - let startDate = new Date(data.start); + let startDate = dayjs(data.start); // set end datetime hours and minutes to the end of the day - let endDate = new Date(data.end); - endDate.setHours(endDate.getHours()+23); - endDate.setMinutes(endDate.getMinutes()+59); - endDate.setTime(endDate.getTime()-86400000); + let endDate = dayjs(data.end).endOf('day'); $('#placeBookingModal').modal('show', $('