Forum Academy Marketplace Showcase Pricing Features

Booking period search not working

Hello,

I want to make a search for hotel rooms. It should check if a room is available for the time period selected.

To simplify everything, I have created a Hotel Type with just, name and a list of date ranges for booked periods (every time s.o. books a time slot this date range is added to this list).

I also have 2 helper variables stored in index the form of states as is_booked(boolean) and daterange (daterange).

Now when I do the search, I store the dates as a daterange in the state. I wanted to compare it to the list of booked dateranges (see img below). Seems it cannot compare one daterange to a list of dateranges. Any suggestions how to solve this?

image

Thx Gerd

Did you ever figure this out? I’m basically trying to do the same thing except trying to compare a LIST of date ranges to a LIST of other date ranges…Can’t figure it out.

@tonymoulatsiotis I think I can help you there. Do you want to match date/time ranges between two resources?

i have an example using the Full Calendar Scheduler Suite plugin here
https://jaredgibb.bubbleapps.io/version-test/coordinating_scheudles?debug_mode=true
check it out

Like resource A is available
Mon
9-10:30 and 2-5

And Resource B is available
Monday 10:00-3

And you need them together for 1/2 hour

So they could meet
10-10:30
2:00-2:30
2:15-2:45
2:30-3

Or do you need to exclude certain date/time ranges based on being busy?

Yeah basically what I am doing is:

Dispatch creates a booking with a start and end time. Bubble saves the date range in the background. It also adds that date range to the Pilot and the Aircraft selected in the booking.

Dispatch goes and makes another booking. Say they choose the same date/times as the previous booking. I don’t want to same Pilot and Aircraft to be available to choose, since they are no longer available as a booking was just made.

I was able to accomplish this by changing the visibility of the buttons representing the aircrafts/pilots based on whether that User or Aircraft has a booking time overlapping with the time Dispatch is choosing in the booking screen.

So it just turns the button invisible if that user has an overlapping booking.

What I’m trying to do now is see if I can use Bubble’s calendar plugin, along with it’s drag and resize features to update the bookings. I’m able to get it to update the Start and End times, but still trying to figure out how to use those events to update the booking date range. I thought the best way to do this would be to check if the booking’s built in “Date Modified” field has changed, then update the booking date range field, however there doesn’t seem to be a simple way to check this. I’m trying to save the modified date as a state on the calendar, then compare the modified date once I move or resize the booking, to the date saved in the state but that doesn’t seem to work.

There’s no option to just check if the modified date has changed and do something based on that.

I still intend on checking out your calendar plugin next week when I go on my days off.