Use Drupal's configured date formats

Created on 30 January 2023, almost 2 years ago
Updated 17 February 2023, almost 2 years ago

Problem/Motivation

When viewing /admin/content/notification-message, the list of notification messages' publish start/end dates isn't using a date format that I've configured. It uses it's own hard-coded date format that has a two-digit year.

Steps to reproduce

Create a notification message and view the page.

Proposed resolution

Use DateFormat::load('short')->getPattern() in NotificationMessageListBuilder::buildRow.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

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

Comments & Activities

  • Issue created by @solideogloria
  • @solideogloria opened merge request.
  • Status changed to Needs review almost 2 years ago
  • πŸ‡ΊπŸ‡ΈUnited States asherry

    @solideogloria I like the idea of being able to customize that date, but the "short" date is config that isn't actually required or locked. It's only default config that's installed on drupal install, and it can be deleted.

    For a custom module that's fine, but for contrib it would be problematic, as any site with the short date format missing would then break when the code tries ->getPattern() on the NULL that's loaded from DateFormat::load('short')

  • Status changed to Needs work almost 2 years ago
  • πŸ‡ΊπŸ‡ΈUnited States asherry

    I also think that the format "short" might not be the best assumption for an admin screen. I would imagine if some sites want to use a short format for node teasers, or taglines, they might not intuitively know that they're also changing what will show up for admins. On some larger scale sites these are even likely to be two different admins.

    I would recommend maybe creating a default view that would be created on module install. (once this ticket is merged #3270975: Notification content is not available in Views β†’ ) That view could be setup default with a new date format called "admin_notification_message", or something to that effect. That view can then replace the admin view that's currently in a controller.

Production build 0.71.5 2024