From d27817ad51840f87f150541449ab5c3c7277407a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Efra=C3=ADn=20Roch=C3=ADn?= Date: Tue, 21 Mar 2023 03:43:36 -0700 Subject: [PATCH] Add a minute in endTime working hours when 11:59 is selected (#7852) Co-authored-by: Bailey Pumfleet --- packages/features/bookings/lib/handleNewBooking.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/features/bookings/lib/handleNewBooking.ts b/packages/features/bookings/lib/handleNewBooking.ts index c560bdb524..95aa37aa15 100644 --- a/packages/features/bookings/lib/handleNewBooking.ts +++ b/packages/features/bookings/lib/handleNewBooking.ts @@ -131,7 +131,9 @@ const isWithinAvailableHours = ( for (const workingHour of workingHours) { const startTime = getTime(timeSlotStart, workingHour.startTime); - const endTime = getTime(timeSlotEnd, workingHour.endTime); + // workingHours function logic set 1439 minutes when user select the end of the day (11:59) in his schedule + // so, we need to add a minute, to avoid, "No available user" error when the last available slot is selected. + const endTime = getTime(timeSlotEnd, workingHour.endTime === 1439 ? 1440 : workingHour.endTime); if ( workingHour.days.includes(timeSlotStart.day()) && // UTC mode, should be performant.