Webflow sync, pageviews & more.
NEW

How can I add date filtering to my current list of filters in Webflow using Finsweet CMS Filtering?

TL;DR
  • Add a hidden date field to each CMS item and a date picker input to your UI.
  • Use custom JavaScript to compare selected dates with item dates and hide non-matching items after Finsweet’s filters run.

To add date filtering to your existing filters in Webflow using Finsweet's CMS Filter, you'll need to configure a custom date input and extend the FS CMS Filter script to support date-based logic.

1. Prepare Your CMS Date Field

  • Make sure your CMS Collection has a Date or Date/Time field (e.g., "Event Date").
  • On your Collection List item, bind this field to a hidden element (like a div) using a custom attribute such as fs-cmsfilter-field="date".
  • Format the date consistently (e.g., YYYY-MM-DD) to simplify filtering logic.

2. Add a Date Input UI

  • Add a Date Picker input to your filter UI and set its name or id (e.g., id="filter-date").
  • You can also use two inputs (start and end date) for a range filter.

3. Extend FS CMS Filter (with custom code)

Finsweet’s native filter does not natively support date comparisons, so you’ll need custom JavaScript to compare item dates against the user-selected date range.

  • Include your filter logic inside fs-cmsfilter’s afterFilter or onclick event.
  • Use JavaScript to:
  • Read the input's selected date.
  • Loop through each CMS item.
  • Compare the selected date with the CMS item’s hidden date value.
  • Use display: none to hide items that don’t match the criteria.

4. Maintain Compatibility with Current FS Filters

  • Ensure your custom date filter integrates smoothly by running your date filtering logic after FS filter updates.
  • You can hook into the FS CMS Filter lifecycle like this:
  • Use window.fsAttributes.cmsfilter promise to access render or filteritems events and apply date-based visibility toggles accordingly.

5. Optional - Use UI Libraries

  • For better user experience, you can integrate libraries like flatpickr or Pikaday to enhance the date input field.
  • Make sure these libraries do not conflict with Webflow or Finsweet scripts.

Summary

To add date filtering with Finsweet CMS Filter in Webflow, use a hidden field to store each item’s date, create a date input, and write custom JavaScript to compare selected dates with each item’s date. Finsweet doesn't handle date logic natively, so manual comparison after FS filtering is key.

Rate this answer

Other Webflow Questions