2

I have a calendar for a location that combines recurring events with individual events. I'm trying to list out the upcoming events for the next 90 days, but I'm running into issues with the repeating events. I'd like to list the individual events by dates, and then have the repeating events listed once, with their rule (i.e. Every Monday: Event Title).

{% set eventOptions = {
    calendar: 'otherEvents',
    dateRangeStart: 'today',
    dateRangeEnd: '+90 days',
} %}
{% set otherEvents = craft.calendar.events(eventOptions) %}

This gives me a list of all events, but it is overwhelmed by recurring events. I can turn them off by adding loadOccurrences:false, but I'm having trouble loading them on their own.

 {% set eventOptions = {
    calendar: 'otherEvents',
    loadOccurrences: false,
} %}
{% set otherEvents = craft.calendar.events(eventOptions) %}

This gives me a list of individual events and a single instance of each repeating event, but it also shows expired events. As soon as I add a date range, the recurring events go away.

Is there any way to get JUST the recurring events, listed once, with their repeat rule? Essentially, i need a loadOnlyOccurrences option.

1

The limitation here is that the loadOccurrences: false parameter only checks for "Primary" events (first occurrence) within the specified timeframe. So if the first occurrence is outside of the specified timeframe, the event won't show at all.

  • So there is no way to limit the list to only recurring events? I could just leave the date range open-ended if there were a way to filter out then non-recurring events. – artmem May 17 '17 at 21:00
  • You're wanting to only list events that recur? As in, hide events that don't recur? – Solspace May 18 '17 at 15:26
  • Yes, exactly. With only an individual instance of each recurring event. Ultimately, I want to have a list of all upcoming nonrecurring events in the next X days, with a list of all recurring events below it (also, is there a way to customize the output of the readableRepeatRule tag? It's way more verbose than I need). – artmem May 19 '17 at 17:45
  • This currently isn't possible with Calendar at this time. The only functionality available is to display all available recurrences OR the "parent" (first) occurrence only, as long as it fits within the timeframe. We do have what you're looking for on our feature request list however. :) – Solspace May 19 '17 at 18:24
  • @Solspace Any update on this? I need to be able to list all active (having future occurrences) events in a list that has 'loadOccurrences: false', otherwise switching it off isn't that useful. – Lukigi May 12 '18 at 19:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.