Events | Expire Events from List View from Event Start Date

Not sure if this is possible or not, but I have 5 sites using the Events Module, which is working well for the most part.

I’ve been using the events module to output events in List View using the Event Start Date. The problem with this is if it is an event that is set for say June 5th, when outputting based on the Event Start Date, it will still show. If I sort ASC it outputs current to last, if I sort DESC, it outputs last to current.

No, I don’t want to use the Release Date, as the Release Date is not relevant to the Event Start Date. No, I don’t want to set an Expiry Date because I still want to output the event on the Event Calendar output. No, I don’t want to output using the Event End Date.

So, wondering if it is possible to have, have the Events not show if the the event if it is past the Event Start Date, for the List View option only? Like I said, I need to be able to still show past events via the Event Module.

My two cents for future backlogs. But for now, my only work around is to set an Expiry Date for the event item, but this removes it from the Calendar.

I suppose I could create some funky liquid loop… but hey, who has time for that.

In your list view/layout could you just add a forloop that says IF EventStartDate >= Now Date? or am I missing something?

1 Like

Well, it’s not pretty, but it works, for current month + 3:

{% assign current_month = 'now' | date: "%m" | plus: 0 %}
{% assign month_plus_one = 'now' | date: "%m" | plus: 1  %}
{% assign month_plus_two = 'now' | date: "%m" | plus: 2  %}
{% assign month_plus_three = 'now' | date: "%m" | plus: 3  %}

{% component source: "Event", layout: "", sortBy: "EventDateStart", sortOrder: "ASC", object: "collection", collectionVariable: "event_month", limit: 200, type: "module" %}
{% for item in event_month.items %}
{% if item['EventDateStart'] | date: "%m" | plus:0 == current_month or item['EventDateStart'] | date: "%m" | plus:0 == month_plus_one or item['EventDateStart'] | date: "%m" | plus:0 == month_plus_two or item['EventDateStart'] | date: "%m" | plus:0 == month_plus_three %}
<p>Event Name: {{item['Name']}} | Event Start: <strong>{{item['EventDateStart'] | date: "%m"}}</strong></p>
{% endif %}
{% endfor %}
1 Like