Filter repeating group by date

Hi all,

I am trying to filter my repeated group by the creation date of each record in it. I can’t seem to make it work. I have a screenshot of my app here.

the group should filter and only show results from the date selected in the date picker. However when any date is selected, the whole repeating group goes blank?!

I think this is something to do with the date saving the creation time as well as just the date. How can i solve this and make it work? I’ve been tearing my hair out for hours over what i think should be quite a simple filter,

3 Likes

‘Date’ values in Bubble (and in Javascript) represent precise moments in time, recorded to the nearest millisecond.

Currently you’re using the date/time picker’s exact value as a constraint in your search. That means only items in your database which were created at the precise same millisecond of the date/time picker’s value will be returned.

When you use a date/time picker to select a date only (without a selected time), its value will be the precise moment (to the nearest millisecond) of midnight (12:00am) in the user’s (who selected the date/time’s value) timezone for the selected day.

So unless there were items created at that same millisecond, nothing will show up in the RG.

I’m not sure exactly what you’re trying to do, but I’m guessing you want to show items created on the same day as the chosen date/time?

In that case you need to search for items that were created on, or after the chosen date/ time, but before the chosen date/time plus 1 day.

The selected date/time picker’s value will refer to 00:00 (in the user’s timezone) on the chosen day, so using 1 constraint of: Created Date ≥ Date/Time Picker's value and another one of Created Date < Date/Time Picker's value +(Days):1 should return the results for the selected day.

Alternatively, you could use an advanced filter on the returned results, and use ‘rounding’ to match the created date of items to the value of the date/time picker to the nearest day, but in most cases it will be preferable to apply the search constraints outlined above rather than filtering the results.

4 Likes

Thanks @adamhholmes , that’s solved the problem perfectly.
I don’t Think i ever would have managed to work that out myself!

1 Like

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