# Help filtering content based on a date range i.e. 2 date pickers

**URL:** <https://forum.wixstudio.com/t/help-filtering-content-based-on-a-date-range-i-e-2-date-pickers/1804>\
**Category:** Ask the community\
**Tags:** code, question\
**Created:** [April 8, 2023, 6:27pm UTC](https://forum.wixstudio.com/t/help-filtering-content-based-on-a-date-range-i-e-2-date-pickers/1804 "2023-04-08T18:27:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![amanda30721](https://avatars.discourse-cdn.com/v4/letter/a/e9bcb4/32.png) [@amanda30721](https://forum.wixstudio.com/u/amanda30721)\
**Post date:** [April 8, 2023, 6:27pm UTC](https://forum.wixstudio.com/t/help-filtering-content-based-on-a-date-range-i-e-2-date-pickers/1804/1 "2023-04-08T18:27:32Z")

</div>

I have an event directory page that displays a list of events (i.e. repeater) including name, location and the date of the event. Since some events are multiple days long, I have an events database that collects both start date and end date for each event.

I am displaying a date picker for the user to select a “start date” and then another date picker for the user to select an “end date”. How can I return all entries where the event’s **start date** falls within the range specified by the date pickers?

import wixData **from** ‘wix-data’ ;

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

$w ( “#datesearch” ). onClick (() =\> {  
**let** fromDate = $w ( “#startDatePicker” ). value ;  
**let** toDate = $w ( “#endDatePicker” ). value ;

```
wixData . query ( 'Items1' )  
  . between ( 'date' , fromDate , toDate ) //'date' is the start date 
  . or ( wixData . query ( 'Items1' ). between ( 'endDate' , fromDate , toDate )) 
  . find () 
  . then (( results ) => { 
    console . log ( results . items ); // display the selected items in the console 
  }) 
  . **catch** (( err ) => { 
    console . log ( err ); 
  }); 

```

});  
});
