# Display repeater items depending on date (only futur events)

**URL:** <https://forum.wixstudio.com/t/display-repeater-items-depending-on-date-only-futur-events/37282>\
**Category:** Ask the community\
**Tags:** question, code\
**Created:** [June 14, 2018, 8:05am UTC](https://forum.wixstudio.com/t/display-repeater-items-depending-on-date-only-futur-events/37282 "2018-06-14T08:05:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![fabclairet](https://avatars.discourse-cdn.com/v4/letter/f/58f4c7/32.png) [@fabclairet](https://forum.wixstudio.com/u/fabclairet)\
**Post date:** [June 14, 2018, 8:05am UTC](https://forum.wixstudio.com/t/display-repeater-items-depending-on-date-only-futur-events/37282/1 "2018-06-14T08:05:47Z")

</div>

Hello,  
I would like to display items from a collection in a repeater depending on a date field in this collection.  
I would like to display only items whose current date has not exceeded the item’s date field, which means only futur events (and not passed).

How can I do that?  
Thank you

---

<div class="post-metadata">

**Author:** ![andreas-kviby](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/andreas-kviby/32/790_2.png) [@andreas-kviby](https://forum.wixstudio.com/u/andreas-kviby)\
**Post date:** [June 14, 2018, 8:15am UTC](https://forum.wixstudio.com/t/display-repeater-items-depending-on-date-only-futur-events/37282/2 "2018-06-14T08:15:22Z")

</div>

Hey  
Connect a dataset to your repeater and make sure everything looks like you want it to be.

Then in the onReady function of your page write this

```javascript
let today = new date();
$w("#YOURDATASETID").setFilter( wixData.filter() 
  .gt("your date field key here", today)
);

```

Then only records where the field which holds the date is greater than today will be shown. If you want greater than or equal use .ge instead of gt in the setFilter.

Hope this helps.

---

<div class="post-metadata">

**Author:** ![fabclairet](https://avatars.discourse-cdn.com/v4/letter/f/58f4c7/32.png) [@fabclairet](https://forum.wixstudio.com/u/fabclairet)\
**Post date:** [June 14, 2018, 9:05am UTC](https://forum.wixstudio.com/t/display-repeater-items-depending-on-date-only-futur-events/37282/3 "2018-06-14T09:05:19Z")

</div>

Thank you very much, it works very well 😉

---

<div class="post-metadata">

**Author:** ![freegayvideoentertai](https://avatars.discourse-cdn.com/v4/letter/f/bbce88/32.png) [@freegayvideoentertai](https://forum.wixstudio.com/u/freegayvideoentertai)\
**Post date:** [September 26, 2021, 12:28pm UTC](https://forum.wixstudio.com/t/display-repeater-items-depending-on-date-only-futur-events/37282/4 "2021-09-26T12:28:52Z")

</div>

I have tried to apply this but I receive an error. The aim is to show all items in the repeater where the release date is passed or the same date as today. I used the .le function. However, the error I get is “ReferenceError: date is not defined” and highlighting that the error is in the line where the " **let** today = **new** date ();" is . So somehow I am missing something. Can anyone help?

I am very new to velo coding and have no knowledge of java whatsoever. So sorry if this may seem a stupid question.

My code is:

$w . onReady ( **function** () {

```
**let** today = **new** date (); 
$w ( " #db_Content " ) 
. setFilter ( wixData . filter ()  
. le ( " releaseDate " , today ) 
); 

```

});

All help is appreciated.

---

<div class="post-metadata">

**Author:** ![ietzenboorsma](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/ietzenboorsma/32/26046_2.png) [@ietzenboorsma](https://forum.wixstudio.com/u/ietzenboorsma)\
**Post date:** [September 5, 2022, 9:14pm UTC](https://forum.wixstudio.com/t/display-repeater-items-depending-on-date-only-futur-events/37282/5 "2022-09-05T21:14:31Z")

</div>

Hi,

I’ve had the same issue where “today” seemed to be undefined in the debugger. The thing that fixed it for me is to set the date field in the CM to include time.
