Added Today, Yesterday, 30 days ago

Hello everybody :wave:

I try not to ask too many questions on here but I’m in need of help with this one.

I have a dropdown element that holds four choices:-

Added: Today
Added: Yesterday
Added: A week ago
Added: A month ago

I have a repeated group that shows properties based on when they were added (or that’s what I’m trying to do). I want properties that were added from midnight that day, to the current time, to be shown when ‘Today’ is clicked. Properties from midnight yesterday for the yesterday option and so forth.

Can somebody explain how this is done? I’ve exhausted all options presently.

Thank you ever so much in advance,

Ash :boy:t4:

You can probably do this with “current date/time” calculation vs your created date for the thing showing in the RG using day length as a break point.

On a side note, depending on how rigid you are with those breakpoints, you may want to check out momentjs. It will help you achieve this but more granular e.g created 1 min ago, created 3 days ago and so on. I think there is a plugin so will save you the time.

1 Like

Hi @dan8,

Thanks for your reply.

I’ve tried it with the current date/time calculation and can’t seem to get it working. When you say day length as a break point can you elaborate?

That’s exactly what I’m looking for ‘created 1 min ago’ etc, for sure!

Ah check out this then:

Amazing! :fireworks:

I’ve managed to use the current date/time calculation you mentioned to resolve my original problem and the Moment.js is amazing, it’s exactly what I needed next so thank you! :sunglasses:

Edit: For anybody who wants to know how I managed it, I created a dropdown menu with ‘Added anytime’, ‘Last 24 hours’, ‘Last 48 hours’ and so forth. I created 3 work flows with an ‘Only when this dropdown’s value is Added anytime/Last 24 hours/Last 48hours’ etc and added a new state to the page as a date with the name ‘AddedFilter’. For the ‘Added anytime’ I left the value blank, for ‘Last 24 hours’ it was ‘current date/time +(days): -1’, for ‘Last 48 hours’ it was ‘current date/time +(days): -2’ and so on. In the repeated group you filter it via Creation date ≥ Page’sAddedFilter.

Note: You may add your state to another element other than the page so your ‘Page’s’ part may be different as well as whatever you name your state, dropdown choices and the duration between choices.

Thanks again to @dan8 :boy:t4:

1 Like