Fetch currentdate - X days in collection ( or console)


I’m implementing some changes for RevPro Italy UI…. I need to modify a collection TypeXXXX.c3ui that is used by the TABYYYYY.c3ui page. In the collection I would need to filter TypeXXXX that have meta.created > currentDate-7 days.

What I mean is something like “filter” : “meta.created >= DateTime.now() -7” ( this code doesn’t work) - does it exist a way to filter for current date - X days?


You couldn’t use DateTime.now() in the filter because it will be passed as a string, not function call, to the backend.

You have to build the timestamp of DateTime.now() -7 in frontend, put in into dateTime, and pass it to the backend.

To build the timestamp, you could use createDynamicDate function. For example,

"filter": "completion > dateTime('{{ standardMoment(createDynamicDate(['start', 'hour'], 'before', '1', 'year')) }}')"

createDynamicDate(['start', 'day'], 'before', '7', 'day')) means creating a timestamp that is 7 days before start of today.


Also, output of createDynamicDate function is a moment.js object, so we need to call standardMoment function to transform moment object to ISO datetime string.


You can also try the expression engine function now().

i.e. filter: “completion > (now() - period(1, ‘DAY’)”


We have identified a bug with now() - period(1, ‘DAY’) and are resolving for the nest version of platform