I need to build a search function which allows 1. name search; 2. date after an input start date; 3. date before an input end date. I want the rule to be: if the user only input one of the three fields, then filter with that one. If all fields are filled then filter with three. For example, if the user only input the start date, then the filter should display all events happening after this start time.
Here is the code I tried:
$w(‘#dataset1’).setFilter(wixData.filter().contains(‘name’, name).between(‘dateAndTime’, startdate, enddate));
However, it only functions with all three fields filled. How can I fix it?