getResources filter TV by date is not working

I’m trying to filter items based on their TV’s date using a getResources call. If the event (eventStart), is greater or less than today.

For upcoming events this works fine:


However for past events this doesn’t work:


For some reason, in my code editor the lower than arrows (<<) are shown in red and the results are not accurate. There are missing items and other items without the eventStart TV appear when they shouldn’t.


The past events that were missing are now showing. I needed to add the “&limit” property and set a high number as it shows only 5 by default.

Now I just need to find a way to exclude the events were the eventStart TV doesn’t exist. These items shouldn’t appear under past events because they don’t have a specific date.

  1. Please don’t worry about red arrows, syntax is correct.
  2. Did you debug what date format comes inside eventStart TV? Maybe there is some kind of format issue, and as a result incorrect selection and sorting … try to clarify, for example, like this:


This doesn’t solve the problem. I already tried it before posting the question.

without tvFilters do you get past events?

Interesting Bruno, I get the exact same result without tvFilters.

maybe past events are unpublished for some reason?

Just double checked and past events are published.

maybe, you should try




and set a &limit property
by default only 5 items are shown

1 Like

I believe you have to use a second condition eventStart!== to exclude resources with an empty TV eventStart. Also make sure that the string from getDate matches the format of the date string in the database table modx_site_tmplvar_contentvalues.

&tvFilters=`eventStart<<[[!getDate:date=`%Y-%m-%d %H:%M:%S`]],eventStart!==`
1 Like

Thanks Bruno, setting &limit property helped.

1 Like

Thank you @halftrainedharry eventStart!== worked perfectly.

seems, his getDate snippet allready returns the correct format
Filtering getResources output based on date TV - Development - MODX Community