[solved] Search for a thing constrained by today's date?

Hey guys, I have this page where I show the list (and a counter in this case) but I need to show only the thing that matches today’s date. It works as a simple search for the list and the counter, but when I use the date as constraint, it shows 0. Do you know why? Or better practice maybe?
Captura de tela de 2022-07-05 17-38-06

Hi there, @Viktor… because Current date/time is the current date and the exact current time (which means none of the reservations are going to meet that exact criteria), change the equals sign to greater than, and then add the :rounded down to operator after Current date/time and select date for the component. You will probably also need to add a second constraint where the date is less than the current date/time plus one day rounded down to date.

Hope this helps.

Best…
Mike

3 Likes

Yes…

Current Date/Time doesn’t mean ‘Today’… it means ‘Now’, this precise moment (to the nearest millisecond).

So your current search search will only show reservations who’s date-in field precisely matches the exact millisecond the search was made (which is extremely unlikely to be any).

2 Likes

Thanks @mikeloc! As soon as you said it, I remember a really old video about this which I completely forgot for 2 hours aparently rsrs. But just using the :rounded already did the job. Thanks for your time!

1 Like

Also instead of the rounding down you can do Things date/time:extract date = Current date/time:extract Date

@tylerboodman Just be sure you’re getting a date (mm/dd/yy) and not the number of the “date” (dd) when you use operations like that; I’ve been tripped up by that before.

Yep good point actually. Thanks

1 Like

Hi!

From my experience, the best way to match dates is to format both dates to text.

What i always do is format both dates using :format as Custom yymmdd

Then match them.

Can never go wrong with this.

2 Likes

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