Check if date range overlaps with a least one date range from a list

I am trying to build a room booking system. In my DB I have a “room”-thing, which contains a list of bookings, each of which consists of a guest (User) and a date range.

For the booking process, I have a Date Picker element where users can select when they want to book the room. Now to check if the room is available, as far as I know, I need to output if the date range selected by the user overlaps with one of the date ranges of the bookings of the room.

  1. How can I perform this “date range does/does not overlapt with at least one date range from the list of bookings” operation? I can only select “overlaps with first/last etc. element”, but not "overlaps with any element.

  2. Does my architecture make sense at all, or is there a better way to set up such a room booking system?

Many many thanks in advance for your help!

3 Likes

Same problem, any solutions?

plus one

Late reply but searching for a similar issue and most of the threads seem overly complicated. I think maybe bubble has many ways to solve some problems but here is the way I approaching solving mine…

  1. Do a search for the thing you want, this results in a list.
  2. Use the :minus list option and choose Do a search for.
  3. Choose the Things you need to check, eg the list of existing bookings
  4. Make sure you have a “date range” field in your db for those things, eg the booking date range. You have a “date interval” type and I think this should be “date range”.
  5. Chose the date range field and “overlaps with” and choose eg start.value <!-range-> end.value fields for your project.
  6. This results in a search for all, minus the list of search items that you found overlapping the dates.
1 Like