Skip to content

Commit

Permalink
Add a minute in endTime working hours when 11:59 is selected (#7852)
Browse files Browse the repository at this point in the history
Co-authored-by: Bailey Pumfleet <bailey@pumfleet.co.uk>
  • Loading branch information
roae and baileypumfleet authored Mar 21, 2023
1 parent 7af2330 commit d27817a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/features/bookings/lib/handleNewBooking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit d27817a

Please sign in to comment.