Allow users to change comment display date format

Created on 27 November 2017, over 6 years ago
Updated 22 January 2024, 5 months ago

Problem/Motivation

The date display of a comment cannot be changed in the configuration or GUI of the site, and defaults to the medium date format.

Users who want to change the date format (for example to use the long or short format instead) need to add a preproccess function to the theme file to set another format.
function THEMENAME_preprocess_comment(&$variables) { $comment = $variables['elements']['#comment']; $variables['created'] = format_date($comment->getCreatedTime(), 'FORMAT_MACHINE_NAME'); }

Users without access, knowledge or the confidence to do this on the command line, can only work around this by changing the medium date format to fit their need, and then experience that change over the whole site, where ever that format is currently used.

Proposed resolution

Allow a user to change date format on the Manage display form of the Comment Type.

A similar problem exists for nodes, so maybe it's possible to extend the patch done at #1399990: Remove "Display author and date information" in Display Settings in favor of listing Author and Date in Manage Displays → here as well.

Remaining tasks

Follow these steps to verify that changing the date format works.

  1. Visit the Manage display form of the Comment view mode that displays the comment (eg: Full Content)
  2. Click the gear icon next to the Created field.
  3. Change the date format to the one of your choosing.
  4. Save the Manage display form.

User interface changes

none

API changes

none

Data model changes

none

✨ Feature request
Status

Postponed: needs info

Version

10.1 ✨

Component
Comment  →

Last updated 2 days ago

Created by

🇳🇱Netherlands ifrik

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇮🇳India vivek.kekare

    Any update on this please ?

  • Status changed to Needs review 5 months ago
  • 🇺🇸United States cedewey Denver, CO

    I think this is now working. You can change the date format displayed on a comment by doing the following:

    1. Visit the Manage display form of the Comment view mode that displays the comment (eg: Full Content)
    2. Click the gear icon next to the Created field.
    3. Change the date format to the one of your choosing.
    4. Save the Manage display form.


  • Status changed to Postponed: needs info 5 months ago
  • 🇺🇸United States smustgrave

    @ifrik or @vivek.kekare that answer the question?

Production build 0.69.0 2024