How can I make this more efficient?

Great, do you have the links to those?
I’ve gone through almost every thread discussing this on Bubble and most of them don’t deal with times that go after midnight. This kinda thing needs a plugin lol

I was searching outside of the Bubble forum, sometimes things from Google can be adapted. I was looking at this yesterday: Storing opening and closing times in database for stores | Remy Mellet

But people seem to have the luxury of storing a time field which we do not get to do

I’ve included open/closing times in my datatype for exactly this reason. It allows for more data to be extracted such as “Closes at *8PM”, i’m close to solving this now. After midnight is the hardest part because you need to search different open times and compare them.

1 Like

Appreciate your help suggesting the new approach, its all up and running now and works after midnight. Here’s the datatype:
image

I included dates for both the open and close time, the date is ignored but it makes it easy to extract the time and format to 9:00PM for display purposes.

Total minutes is a numeric range used to extract the minutes from the open and close time. If the closing time is less than the open time that means it closes after midnight and I add an additional 1440 minutes (midnight is 1440 minutes) to numeric range max. Then on a page load I can calculate if the user minutes is a point between the 2 ranges.

I’ve eliminated almost all the filters from my searches now,
image

This is the only one that remains as I still need to filter the user preferences. Not sure how to apply constraints to that without the filter, any idea?

Thanks again for the help

Yes does look cleaner now :+1: What is your :filtered filter right now? I totally forgot you can just store the Total minutes to get your closing time, is the closing time field even needed?

When you are storing the Time Close and Time Open are you just doing an arbitrary date or does the user have a date/time picker even though really it’s just hours and minutes needed?

I’m using this filter to filter all the other filters that users can set on the page. This is the filter:

The open and closing time have dates but they aren’t used, just the time is extracted. I’m using air date/time picker that uses just a time picker:
image

When loading the venue page I do a search for the daily Open Time and save it to a state. Then I reference that state to get all the data to put on the page.

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