Logic in bubble expressions

Context: I am trying to prevent overlapping in a booking system as shown below, however books can start and end on the same time, they just cant intersect
Red = Range 1 (Existing bookings)
Blue = Range 2 (people trying to book)
S = Start time
E = End time

I have been trying to manualy do it by using and / or operators but its not really working and overlaps with doesnt allow me to have bookings start and end one after the other

For your logic start and end can be the same date, but the operator overlaps with returns true if the end of the first range is the same date as the start of the second range.
One option that you can try is using modified ranges for this logic where the end is 1 second less that the real end.
range 1 β†’ original: 2023-08-17T10:00:00 - 2023-08-17T11:00:00, modified: 2023-08-17T10:00:00 - 2023-08-17T10:59:59
range 2 β†’ original: 2023-08-17T11:00:00 - 2023-08-17T12:00:00, modified: 2023-08-17T11:00:00 - 2023-08-17T11:59:59
range 1 original β†’ overlaps with β†’ range 2 original returns true
range 1 modified-> overlaps with β†’ range 2 modified returns false

When doing a search for, How do I modify the End’s time by 1 second?



not entirely working, how do i adjust the end time by 1 second for each of the existing booking dates it compares with in the first picture?

I get what you mean in the first reply about adjusting the times by 1 second, just having issues implementing it since im new to bubble

If you use it a lot you may want to just save it in the database when you save the original date. Or you can save only the modified range and add that second back in the displayed ui. It really depends on your specific case. Play with it and see if it works for you.

1 Like

Gone with the approach to store a modified range, I really appreciate your help, you have provided a really effective solution.

I had spent 3 hours before this trying many logic cases… :sweat_smile:

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.