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?
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.
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.