Month-only formatter incorrectly outputs ‘to YEAR’ for same-month ranges in non-current years

Created on 25 August 2025, about 1 month ago

Problem/Motivation

The month-only date formatter incorrectly renders ranges that begin and end in the same month of a non-current year.
Instead of collapsing to a single month label (e.g., “Sept. 2023”), it outputs “Sept. to 2023” (or “Sept. to 2024”), leaving a dangling connector and awkward spacing.

This could causes confusing and incorrect display of dates for editors and site visitors.

Steps to reproduce

1. Configure a field to use the month-only formatter.
2. Enter a date range within the same month of a previous year (e.g., Sept 5, 2023 – Sept 21, 2023).
3. View the formatted output.
4. Observe the result includes “to YEAR” instead of collapsing to a single month/year.

Proposed resolution

Update the month-only formatter logic so that:
- If start and end month/year are identical:
- Collapse to a single month.
- Append the year if it is not the current year, or if “always_display_year” is enabled.
- Suppress the connector (“to”) when no differing month or year is displayed.
- Add explicit test coverage for same-month ranges in both current and non-current years.

Remaining tasks

- Adjust formatter logic.
- Update and expand Kernel tests for single-month ranges.
- Verify no regressions in cross-month or cross-year cases.
- Review and commit patch.

User interface changes

None (affects formatted output only).

API changes

None.

Data model changes

None.

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇺🇸United States trackleft2 Tucson, AZ 🇺🇸

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