Filtering getResources output based on date TV

I want to filter getResources output based on date TV. This approach should be showing upcoming events only but is showing both, past and upcoming events.

Settings:

<?php
$scriptProperties = array(
    'parents' => '2',
    'depth' => '10',
    'limit' => '20',
    'showHidden' => '0',
    'includeTVs' => '1',
    'processTVs' => '1',
    'tvPrefix' => '',
    'tvFilters' => 'eventStart>>[[!getDate]]',
    'sortbyTV' => 'eventStart',
    'sortdirTV' => 'ASC',
    'includeContent' => '0',
    'tpl' => 'cardEventHorizOverlay'
);
$output .= $modx->runSnippet('getResources', $scriptProperties);
return $output;

getDate snippet:

<?php
return date('Y-m-d H:i:s');

Thank you,

This doesn’t work:

'tvFilters' => 'eventStart>>[[!getDate]]',

Use

'tvFilters' => 'eventStart>>' . date('Y-m-d H:i:s'),

or call getDate with $modx->runSnippet().

1 Like

Thank you Harry! This worked like a charm.