Searching a date in a List of Date Ranges

Hi there, @kmeenakshi26… my apologies for not being clearer in my last response, but that is definitely not what I was suggesting, and you were being much too kind by stopping at “it’s not very elegant”. :slight_smile:

My suggestion centers around completely removing the concept of availability from the Listing data type, and instead, you would have an Available data type that looks like this…

availability

As owners enter an available date range for a specific listing, instead of making changes to the listing’s record in the Listing table, you would create a new thing in the Available table, and that thing includes the listing itself and the date range the user entered. So, if an owner enters five available date ranges for one listing, you would have five separate records in the Available table, and each one of those records would have that listing’s ID in its listing field.

Does that make more sense now?

To go a bit further (and as Boston pointed out), when a booking is made for a listing, you would create a record in the Bookings table, and you would also search through the Available table for a “conflicting” record (that is, a record for the specified listing that includes the booked dates), and you would remove that record from the Available table.

Happy to provide more details and/or screenshots if you want to go this route and need any help… so just let me know.

Best…
Mike

1 Like