Compare commits
2 commits
fa7436a499
...
13dd3fde59
| Author | SHA1 | Date | |
|---|---|---|---|
| 13dd3fde59 | |||
| 6f56e999d6 |
1 changed files with 12 additions and 2 deletions
|
|
@ -122,7 +122,13 @@ function isDateDisabled(d: DateValue): boolean {
|
||||||
}
|
}
|
||||||
if (y === start) return false
|
if (y === start) return false
|
||||||
if (y > start) {
|
if (y > start) {
|
||||||
if (y < addDays(start, props.minNights)) return true
|
// Do NOT disable the days inside the minimum-stay window here: reka-ui
|
||||||
|
// refuses to complete a range that *spans* a disabled day, so disabling
|
||||||
|
// start+1 (for a 2-night minimum, etc.) makes every forward check-out
|
||||||
|
// unreachable — the guest can only click an earlier day, which reka
|
||||||
|
// swaps in. The minimum stay is enforced in onModel instead (a too-short
|
||||||
|
// range keeps the check-in and clears the check-out). Occupied nights
|
||||||
|
// past the next booking still cap the range.
|
||||||
if (boundary.value && y > boundary.value) return true
|
if (boundary.value && y > boundary.value) return true
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
@ -143,8 +149,12 @@ function onModel(v: RekaDateRange | null) {
|
||||||
const ok =
|
const ok =
|
||||||
stayIsFree(props.nightSet, ci, co) && nightsBetween(ci, co) >= props.minNights
|
stayIsFree(props.nightSet, ci, co) && nightsBetween(ci, co) >= props.minNights
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
// Defensive: reka let a bad range through — keep the check-in, redo the end.
|
// A range too short for the minimum stay (or spanning an occupied
|
||||||
|
// night). Keep the check-in and redo the end. checkOut is already ''
|
||||||
|
// here, so the props watch won't fire — reset reka's controlled model
|
||||||
|
// directly, otherwise its highlighted end lingers on the rejected day.
|
||||||
pendingStart.value = ci
|
pendingStart.value = ci
|
||||||
|
model.value = { start: fromYmd(ci), end: undefined }
|
||||||
emit('update:checkIn', ci)
|
emit('update:checkIn', ci)
|
||||||
emit('update:checkOut', '')
|
emit('update:checkOut', '')
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue