Forum Academy Marketplace Showcase Pricing Features

How do you handle time slots efficiently?

Lots of apps on bubble are market places, with the need to handle slots of date and time. How do you actually do that efficiently?

I need to save “availability” on the back-end, and show it on the front-end. I’m struggling to get it right.

I can use the tool time-picker to collect a start-time, and an end-time. CHECK
I can use a time-picker to display a min/max time based on above. CHECK

But what to do with time (considering time picker doesn’t separate date and time)? My current solution is:

hard code static values <-- makes ordering outside of time range possible. NOT GOOD. If you change the input instead to be separate fields for (year)/month/day/time, you run into formatting issues, especially on the input side.

Now I’m trying to create a data type with all times, then “search for” all slots contained within [Start time][End time] but can’t seem to structure it correctly. A combination of


It’s easier if all numbers, but now I’m dealing with date and times.

Are you looking for a way to save available time slots regardless of the date? If so, you could save numeric ranges to identify the hours and then :extract hour from a date to see if it is contained within the range. Although minutes would get tricker… so…

You could also just do date ranges (using date/time picker with date and time enabled) solely to retrieve time values. Then to identify whether a selected date/time slot is in an available range, change the date to the date in question so that you’re only comparing times.

Or you can correct me about your goals. There are a few different ways to manipulate ranges, extract date components and time components… just let me know what specifically you’d like to do.

The overall goal is to match user backend “date and time” with front end slots (increments of 15 min) for an ordering system. It would be good to have the time overrule the date, i.e. the same time applies for all days. Example:

time 14-18
days MON-WED = MON 14-18, TUE 14-18, WED 14-18

buuut the time picker let’s a user set a START date and time, and an END date and time. That’s fine because date and time are separated on frontend. User chooses a date within the date range, and this is where it gets tricky, considering you need a range of times, based on 2 end values. You can’t retrieve all values within a range, can you?

Current example:

User1 input
Start MON 14 - End WED 18
User 2 sees
choose MON-WED
choose time (now hard coded but not optimal at all)
so this is my challenge. Does above make it more clear @romanmg?