Streaming live at 10am (PST)

How to display CMS content for current month

I am working on a website for a client that offers cooking classes in 2 different locations. My client wants the end user to be able to filter classes by month (see current month and next month). I know Webflow does not support filtering by month, only relative filtering, which doesn’t quite work. I wanted to see if there’s any JS that can be used to create a page that displays current month’s classes and another one for next month’s classes.

My understanding would be that all items in a collection would be hidden and only those that match current and next month, would be displayed. Any ideas?

You could use the date filed and have it filter 30 days from todays date!

Hi, @WebDev_Brandon.

Thanks but that’s precisely what I meant when I said relative filtering in Webflow won’t work. 30 days from today include dates from September. I need to display August Dates, September Dates, and so on. Any ideas on how to accomplish this with JS?

Thanks

@paco - You could use moment.js or dayjs and some custom javascript to hide elements not in a specific month of the year.
https://momentjs.com/

1 Like