How to select start or end dates of 'isUnavailable' range in useRangeCalendar? #4505
-
Hello. I would like users to be able to select the start date or end date of a range of dates defined as 'isUnavailable' - is this possible at all. The use-case being, using Airbnb for example, is June 7th to June 14th are 'booked', a user should still be able to select June 1st to June 7th for their booking. Any help very much appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Using https://react-spectrum.adobe.com/react-aria/useRangeCalendar.html#unavailable-dates as an example, you could perhaps change unavailable date logic to However, this does mean that a user can select the first day of a booked range as their start date (e.g. if June 7th to 14th is booked, someone could select June 7th to June 7th, assuming that single day ranges are allowed) which feels odd to me. |
Beta Was this translation helpful? Give feedback.
Using https://react-spectrum.adobe.com/react-aria/useRangeCalendar.html#unavailable-dates as an example, you could perhaps change unavailable date logic to
date.compare(interval[0]) > 0 && date.compare(interval[1]) < 0
instead like so. This makes the first/last date in each of the ranges ofdisabledRanges
available.However, this does mean that a user can select the first day of a booked range as their start date (e.g. if June 7th to 14th is booked, someone could select June 7th to June 7th, assuming that single day ranges are allowed) which feels odd to me.