I want to output a list of events some of which are repeating, on a monthly basis. Each event should show up once even if it's scheduled to repeat multiple times in the same month and the information for each event must also include the date of last occurrence if there is one.

To be a little bit more specific I would like to access the value of the field "End repeat" when it's value is set to "On date".

Is this possible?


Do you mean this?

{% set eventOptions = {
    dateRangeStart: targetStartDate,
    dateRangeEnd: targetEndDate,
    limit: 15,
    search: "EndrepeatHandle:On date"
} %}
{% set events = craft.calendar.events(eventOptions) %}
  • That doesn't seem to be returning anything at all. I would like to be able to get a list of events that repeat and output their start and end dates. Eg. "Title of an event: From March 1, 2017, to December 20, 2017" where "December 20, 2017" is the last repeat date selected in the settings of the event. – Panos Spiliotis Dec 12 '17 at 19:35
  • Maybe your query is wrong? Would you mind posting it? – Robin Schambach Dec 12 '17 at 19:38
  • This is the type of query I use: {% set eventOptions = { dateRangeStart: '2017-12-1', dateRangeEnd: '2017-12-31', search: "EndrepeatHandle:On date" } %} {% paginate craft.calendar.events(eventOptions) as pageInfo, events %} ... – Panos Spiliotis Dec 12 '17 at 19:50
  • Of course that will return null.. I wanted to state that you have to include the handle of your end repeat field like stated in the docs. Maybe you have to quote the On date or use wildcards. It's working like the original craft parameter – Robin Schambach Dec 12 '17 at 19:52
  • The "End Repeat" field is not a custom field. It's the one that Calendar uses to set the end date. I couldn't find a way to reference that in the documentation of the plugin. – Panos Spiliotis Dec 12 '17 at 19:59

It turns out that the Calendar plugin provides a property named event.repeating that can be checked to determine if the event is repeating and then use event.readableRepeatRule property to output the last date that the event will repeat on.

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.