Is it possible to filter list items according to a date range? I can find some documentation and discussion for Attributes V1, but not V2. I have tried using greater than ‘start-date’ and less than ‘end-date’ but no success. The filter does work if the specific date matches, but I have filters for ‘This Weekend’ and ‘This Month’ so need to match anything in between.
Most of the events I am filtering span multiple dates, from a few days to a few months so I need the results to show if any of the dates align.
Your List Filter setup is correct, but you have some elements from CMS Nest and v1, which isn’t compatible with List Filter v2. To fix this try using List Nest to nest the elements from the CMS items.
Hi Pedro, I’m looking for help with or documentation on how to set up the ‘to’ and ‘from’ values for the date filter with V2. E.g. can I add them both to the same checkbox, and what are the correct names for these attributes? My checkbox is labelled ‘This Weekend’ so i need > start date and < end date to both be valid.
Re: V1 Nest, can you tell me where you saw this? I do not load the V1 script and have tried to remove any reference to it. FYI, the date attributes are not displayed using List Nest.
Unfortunately there isn’t a single checkbox feature that natively supports both a “from” and “to” date filters.
But I can work in come custom code to achieve that for your project if you want.
And about CMS Nest, you have some attributes still there but you don’t have the v1 script so it’s no problem, if you want you can delete them.
Hi Pedro, thanks for the assistance. I’ve made some changes and progress with the filter but don’t see that the ‘less-than’ operator is working with a date. To simplify the filter I have removed the start-date and just have a dynamic end date (today, tmrw, week, month) which is added to a radio button. The events are filtering if the date matches the end date, but not if it is less than (before) the end date. I have tried ‘fs-list-operator=less’ and ‘fs-list-operator=less-than’ and neither works. Does ‘fs-list-fieldtype=date’ treat the value as a number or a string?
Hi Pedro, are you able to support with the custom code required? It seems dates are easy to compare using the Date object but I am wary of writing custom javascript that doesn’t work with the other filters on the page so need a solution that works with Attributes V2 and combines the filters.