How to Sort Recurring Events by Next Occurrence?

Hello community,

I am facing a challenge with a list block on my Volto site that sorts event content types. Currently, the block sorts all events, whether recurring or one-time, based on their start date. This approach works fine for one-time events but fails to correctly sort recurring events which should ideally be sorted by their next occurrence.

Problem Description:

  • Current Behavior: The list block sorts both one-time and recurring events by their original start date.
  • Expected Behavior: Recurring events should be sorted by the date of their next occurrence, not by their initial start date.

Questions:

  1. How can I adjust the sorting mechanism so that recurring events are sorted by their next occurrence?
  2. Are there specific configurations or customizations in Plone Volto that I can implement to achieve this?

Thank you in advance for your help and suggestions!

I don't know if there's a restapi endpoint for that, but in the backend there's the plone.app.event.base.get_events method with the parameter expand which expands events to its occurrences (within a mandatory timeframe) and sorts them. see plone.app.event/plone/app/event/base.py at master · plone/plone.app.event · GitHub