date_recur_basic_formatter filters out past occurrences by default

Created on 9 April 2025, 13 days ago

Problem/Motivation

The getOccurrences() method in DateRecurHelperInterface is called with the first argument set to now within the date_recur_basic_formatter.
This causes all past occurrences to be filtered out, which is problematic when the field is rendered in a context like a Calendar View
where all (past and future) occurrences for a given date_recur field should be shown, then looking at a past event, the field_date will have 0 occurrences and will not show the date at all because the template will not have anything to show.

This behaviour makes it tricky to view historical event times, limiting the usefulness of the formatter for date-based views.

Steps to reproduce

  1. Create a content type with a date_recur field using the basic formatter.
  2. Add an entity with recurrence rules that include past occurrences.
  3. View the field output in a Calendar View or other display expecting all occurrences.
  4. Only future occurrences are shown, which is sometimes 0, hiding the field all together.

Proposed resolution

Make this configurable, or just show all (NULL start date)

Remaining tasks

  • Update date_recur_basic_formatter to avoid using now as the default start date.
  • Add logic to make this behaviour configurable or context-sensitive.
  • Write tests to verify that past occurrences are displayed when expected.

User interface changes

Potentially a new setting in the formatter to control how occurrences are filtered.

API changes

None expected.

Data model changes

None.

Release notes snippet

The date_recur_basic_formatter now displays all applicable occurrences, including past ones, making it more suitable for use in Calendar Views.

Checklist ✔

  • [ ✔ ] Changeset meets coding standards and project style guide .
  • [ ❌ ] Changeset has tests
  • [ ❌ ] Proposal has been discussed externally (Slack/IRC)
🐛 Bug report
Status

Active

Version

3.9

Component

Code

Created by

🇨🇦Canada joelpittet Vancouver

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024