[pdoTools] How to filter current time with tvFilters?

Hi,

I want to filter events with excluding the older ones (passed events).
I’m using this call :

        [[!pdoResources?
        	&parents=`20`
        	&includeTVs=`Event__Date`
        	&tvPrefix=`tv.`
        	&sortby=`Event__Date`
        	&sortdir=`ASC`
        	&processTVs=`1`
        	&limit=`300`
        	&includeContent=`1`
        	&tpl=`Events__item` 
        	&tvFilters=`[[!+nowdate:default=`now`:strtotime]] <= Event__Date`
        ]]

But it’s not working.
I tried several things and made lots of search but I didn’t found the way to make it works.

Have you an idea what I miss ?

All the TV data is stored as a string. (Because everything is in the same database column, everything has to be the same data type).

Dates inTVs are not stored as a timestamp, but as strings in this format: 2023-12-04 18:00:00

So you have to take that into account when comparing the values with the current date in the filter:

&tvFilters=`Event__Date<<[[!+nowdate:default=`now`:date=`%Y-%m-%d %H:%M:%S`]]`
2 Likes

Thanks @halftrainedharry !
I didn’t know this subtility !

1 Like

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.