I’m attempting to use Finsweet Attributes CMS filtering to filter events based on two checkboxes:
Past. I have access to dates in the collection, and I have written a script to surface the current date and place it in a DOM element so I have a reference point for where the user is in time. As I understand it, the range filter only works with strings, so I would have to stringify all of the dates and could use that to show the events in the string range between a far-past date (ex: 01011994) and today’s date (ex: 06022023), and if I wanted to show any upcoming events, I could set the range for today and a far-future date (ex: 12312050).
- Is there an easier way to do this that I’m missing?
- Is there a way to have more than one range filter in a particular instance of the CMS Filter form element?
Past filter), and if the date is in the future, write “Upcoming” to a sibling element with a class name (referenced by
Upcoming filter). Now you’re not relying on CMS Filtering attributes to ingest the dates and do anything with it, rather it’s just checking each text block for matching values to “Upcoming” or “Past”. Obviously if you need to get more granular with a date range for particular outputs, you should probably use the range slider with a date attribute, but this works well if you’re just measuring by past or future.