Forum Academy Marketplace Showcase Pricing Features

How to change date range:end?

So, basically what I am doing is bookings get created on a calendar on an even timeslot like xx:30 or xx:00. They are created on the hour or half-hour.

In each booking, there is a user assigned. On each user, there is a list of date ranges which is taken from any bookings assigned to them.

For example, I create a booking from 10:00 → 12:00 then that date range is added to whichever user is chosen.

When I edit bookings, I have a dropdown with a list of users filtered by whether the current booking range overlaps with their list of booking ranges.

The problem is, I want to be able to create bookings back to back, like 10:00 - 12:00, 12:00 - 13:00, whatever.

So, technically the 12:00 end from the first booking overlaps with the 12:00 start of the second booking, so when I create that booking I am unable to choose the same user as was chosen in the first one.

I still want to be create the bookings on an even hour/half hour, but be able to have the user show up in the list even if they’re back to back.

How the dropdown filter is now:

Essentially what I was thinking for getting them to show up in the list was to use the filter to take the date ranges and add 1 minute to the start, and subtract 1 minute from the end.

For example
Actual booking start: 28 Aug 2021 10:00
Check overlap: 28 Aug 2021 10:01

Actual booking end: 28 Aug 2021 12:00
check overlap: 28 Aug 2021 11:59

So that when I create a booking starting at 12, the dropdown will “think” for lack of a better word that the user’s last booking ends at 11:59, not 12:00, so that technically they won’t overlap.

The expression doesn’t seem to allow me to manipulate the date ranges in this way though. very frustrating. Anyone know?

So, after searching the forum it seems like this has been an issue since at least 2017!?!? WHAT??

How have the Bubble team not implemented the ability to adjust the end of a date range like you can the start, since 4 years ago!? Please fix this, Bubble.

On the plus side, I believe I’ve got around this by taking suggestions from some other posts by using a custom state.

So, when my popup opens it sets two custom states, start and end to be the current booking’s start time +1 minute and end time -1 minute.

So a booking of 10:00 → 12:00 would create two states of [date] 10:01 and [date] 11:59

Then my filter on the dropdown list of users to choose from to assign the booking to which checks if their current bookings overlap with the booking being created will use those custom state dates to compare against instead of the actual dates, which it won’t overlap with because it is either 1 minute before or after.

I tested it in my calendar and I am able to create back to back events and choose the same user as the previous booking, but not if I do it one half hour block prior because then they will overlap.

Noice!

But…I shouldn’t have to do that. We should be able to edit the :end like we can the :start!!!