Filtering out expired records on a repeater

I’m trying to filter records in my database so that old events aren’t imported into a repeater.
However it is filtering out all event and I can’t seem to figure out what I’m doing wrong.

Any help/advice very much appreciated.

import wixData from ‘wix-data’ ;
// link button
$w.onReady(() => {
$w( ‘#repeater2’ ).onItemReady(($wInRepeater, itemData) => {
const thereIsNoUrl = !itemData.url
if (thereIsNoUrl) $wInRepeater( ‘#button16’ ).collapse()
if (thereIsNoUrl) $wInRepeater( ‘#box5’ ).collapse()
})

// filtering out old events
$w( “#dataset1” ).onReady( () => {
let today = new Date();
console.log(today);
today.setHours( 0 );
today.setMinutes( 0 );
today.setSeconds( 0 );
console.log(today);
$w( “#dataset1” ).setFilter(wixData.filter()
.ge( “#datetime” ,today)
);
});

})

filters work with field names, that are not using the # notation.

instead of

  $w("#dataset1").setFilter(wixData.filter()
          .ge("#datetime",today));

you probably want to use the _updateDate field indicating the last update time of the record - or whatever is the right date field you are using to identify expired records, like

  $w("#dataset1").setFilter(wixData.filter()
          .ge("_updatedDate",today));

Hi Yoav, thanks for the reply.

The client updates the records in bulk so the updateddate field isn’t ideal, hence why I’m using the “datetime” which is the date and time of the actual event.

Though this doesn’t seem to be working and still shows old records when I remove the # as you advised.