From e7d3a838677f374cdc8a958e1b76bb1fe3b9dc9e Mon Sep 17 00:00:00 2001 From: Stephen Adamson Date: Sun, 10 May 2026 12:08:13 +0100 Subject: [PATCH] fix: refine unavailable slot grouping validation logic --- .../lib/components/booking/BookingFlow.svelte | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/frontend/src/lib/components/booking/BookingFlow.svelte b/frontend/src/lib/components/booking/BookingFlow.svelte index e40d367..e019f69 100644 --- a/frontend/src/lib/components/booking/BookingFlow.svelte +++ b/frontend/src/lib/components/booking/BookingFlow.svelte @@ -554,15 +554,16 @@ if (isAvailable) { if (currentUnavailableStart !== null) { - // Use the end time of the last available slot as the start of unavailable period - const unavailableStartTime = lastAvailableEndTime || currentUnavailableStart; const groupEndTime = calculatePreviousTime(timeStr); - groupedSlots.push({ - type: 'unavailable', - startTime: unavailableStartTime, - endTime: groupEndTime, - isGrouped: true - }); + const unavailableStartTime = currentUnavailableStart || lastAvailableEndTime; + if (unavailableStartTime && timeToMinutes(unavailableStartTime) < timeToMinutes(groupEndTime)) { + groupedSlots.push({ + type: 'unavailable', + startTime: unavailableStartTime, + endTime: groupEndTime, + isGrouped: true + }); + } currentUnavailableStart = null; }