From d8141b44856c0fb1caf0218e1f756697b9c21036 Mon Sep 17 00:00:00 2001 From: Padreug Date: Mon, 21 Sep 2026 11:55:51 +0200 Subject: [PATCH] fix(chatelet): don't offer a check-in that can't fit a minimum stay MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The stay picker disabled only occupied nights when choosing a check-in, so a free day with an occupied night closer than min_nights was still selectable — e.g. min 2 nights with the night after next booked. Picking it left every later day disabled (no legal check-out), so reka's only move was an earlier day, which it silently swapped into the range: the guest picks a date and the calendar 'jumps backwards'. Disable such a day up front: a check-in is valid only if the minimum stay fits before the next occupied night and within the loaded window. Co-Authored-By: Claude Fable 5.1 --- .../chatelet/components/StayDatePicker.vue | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/modules/chatelet/components/StayDatePicker.vue b/src/modules/chatelet/components/StayDatePicker.vue index 3c2ee0e..2cb3ae2 100644 --- a/src/modules/chatelet/components/StayDatePicker.vue +++ b/src/modules/chatelet/components/StayDatePicker.vue @@ -106,8 +106,19 @@ function isDateDisabled(d: DateValue): boolean { if (y < todayYmd) return true const start = activeStart.value if (!start) { - // Picking a check-in: occupied nights are out; everything else is fair. - return props.nightSet.has(y) && !(bothSet.value && y === props.checkOut) + // Picking a check-in. An occupied night is out — except a committed + // check-out that landed on one, which must stay rendered as selected. + if (props.nightSet.has(y)) return !(bothSet.value && y === props.checkOut) + // A free day is only a valid check-in if a minimum stay fits before the + // next occupied night AND within the loaded window. Otherwise reka would + // offer it, then strand the guest with no reachable check-out (every + // later day disabled), so the only click left is an earlier day, which + // reka silently swaps into the range. Disable it up front instead. + const minCheckOut = addDays(y, props.minNights) + const nextOccupied = nextUnavailableOnOrAfter(props.nights, y) + if (nextOccupied && nextOccupied < minCheckOut) return true + if (props.maxDate && minCheckOut > props.maxDate) return true + return false } if (y === start) return false if (y > start) { -- 2.55.0