Streaming live at 10am (PST)

Using JavaScript variables as CMS filter?


#1

I’m trying to create an event schedule page, which basically means, I have a collection of Events with a Time field and a page that has a Collection list of all events.

I need this page to stay up-to-date throughout the day, so what I want to do is to have any event that has already started removed from the page. Meaning, ideally to create a Collection List filter: Show only items whose time > current time

Any ideas on how to do that?

I wanted to create a currentTime variable and to set a filter to show only bigger numbers than it, but I can only use numbers in the Collection List filter settings and not text.


#2

have a go at using the isotope filter plugin - you can definitely get it working with that. it’s actually quite simple to implement

http://filtering-plugins.webflow.io/isotope-plugin

set up a simple example on jsfiddle.net and play around with it to try get it working. you can also share the jsfiddle link to the code here so others can go on and help you.

good luck


#3

Isotope doesn’t do date filtering…

The only way is custom code. Don’t forget you’ll have to cater for users in different timezones.


#4

Fair enough! However, one could convert the event date into a number - and the same for the time on the users local machine and then compare if one is greater than the other - then it wouldn’t be dates it’d be numbers?

Although it’s probably just easier to do this with a simple javascript function.