Optionally remove year digits if the current year

Created on 12 February 2023, over 2 years 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 review

Version

2.0

Component

Code

Created by

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

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

Comments & Activities

  • Issue created by @natts
  • Status changed to Needs work over 1 year 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.

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

    Patch updated for latest v2.1.x

  • πŸ‡¬πŸ‡§United Kingdom natts London
Production build 0.71.5 2024