Issue with Conditional Display of Collection Items Based on Multiple Date Fields and Categories

Hello, I’m facing a challenge with displaying Collection Items conditionally in Webflow. I have a list of hotels that need to be shown or hidden based on contract dates. Each hotel is categorized into one of three groups, and the visibility depends on two date fields: ‘Contract Start Date’ and ‘Contract End Date’. Not all hotels have these dates as some are ongoing partnerships without specified end dates.

Here’s the issue: When I set the filters to match ‘all’ conditions, nothing displays because some hotels don’t have dates assigned. If I switch to ‘any’ conditions, the results ignore the categories due to the date fields. I need a way to display hotels that either match the current date criteria or have no dates defined, all while respecting their categorization.

I’ve tried adjusting the filters, but I can’t seem to include items with empty date fields when using ‘all’ conditions. Is there a way to set up the filters or should I resort to custom code to achieve the desired functionality? If custom code is the solution, could anyone guide me on how to implement it, taking into account the different categories and the presence (or absence) of date fields?

I appreciate any help or suggestions from the community. Please let me know if you need more details or a read-only link to my project.

https://preview.webflow.com/preview/flospitality?utm_medium=preview_link&utm_source=designer&utm_content=flospitality&preview=3c7e6e31623dc152491f0168db82b9a4&pageId=60bf3f5c07e42248dab3d946&workflow=preview

Hey Arno, it’s not ideal but if you want to avoid custom coding here’s an approach that should work OK for you.

Create multiple collection lists, one for each set of filter rules. One for ongoing partnerships, and one for your date-constrained partnerships. Get all of the first hotels on the page, even though they’ll be in separate collection lists.

Then use Finsweet’s CMS Combine lib to merge them into a single list for cleaner layout options.

Then use Finsweet’s CMS Sort lib to re-sort them appropriately. There is some js code in their docs that talks about how to initialize the sort to a particular setup on page load. If you want, you can expose other options too… sort by name, sort by price, sort by rating.