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.
- Visit the Manage display form of the Comment view mode that displays the comment (eg: Full Content)
- Click the gear icon next to the Created field.
- Change the date format to the one of your choosing.
- Save the Manage display form.
User interface changes
none
API changes
none
Data model changes
none
Comment | File | Size | Author |
---|
Comments
Comment #3
cgomezgI use these one because format_date() is deprecated
Comment #14
vivek.kekare CreditAttribution: vivek.kekare commentedAny update on this please ?
Comment #15
cedeweyI think this is now working. You can change the date format displayed on a comment by doing the following:
Comment #16
smustgrave CreditAttribution: smustgrave at Mobomo commented@ifrik or @vivek.kekare that answer the question?