Optionally remove year digits if the current year

Created on 12 February 2023, almost 2 years ago
Updated 2 April 2024, 9 months ago

Motivation

To compact the output even further, there could be a Boolean configuration setting for each compact date range format to optionally remove the year values (and any preceding whitespace and/or single quote if a two digit year) from the final string, if both the start and end years are the current year.

So for example, outputs like "12th - 14th February 2023" or "12-14 Feb '23" become simply "12th - 14th February" or "12-14 Feb" while it is 2023.

Proposed resolution

A new checkbox field in the configuration of each compact date range format to turn this functionality on or off, defaulting to off.

I've attached a patch that works for me. If the module maintainer is happy, I can commit the changes to the module dev branch?

✨ Feature request
Status

Needs work

Version

2.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom natts London

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

  • Issue created by @natts
  • Status changed to Needs work 9 months ago
  • πŸ‡ΈπŸ‡ͺSweden erik.erskine

    Interesting suggestion. This is going to need test coverage before anything else.

    One thing to bear in mind: introducing the notion of "current year" to the display makes this time-sensitive. That has implications for cacheability. For example, if we reduce "12th - 14th February 2024" to "12th - 14th February", the output is now only valid till the end of 2024.

Production build 0.71.5 2024