Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-31636

Comments API needs to allow plugins to set the date format

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.2.1, 2.4.1
    • 2.4.2
    • Comments
    • MOODLE_22_STABLE, MOODLE_24_STABLE
    • MOODLE_24_STABLE
    • Hide

      1) you need to be a developer to test this as this is an API option that is as yet unused within core. Please read through entire test before commencing.
      2) edit the comments block display callback to change the display format in each of the comments
      (New version)
      blocks/comments/lib.php:

      function block_comments_comment_display($comments, $args) {
          if ($args->commentarea != 'page_comments') {
              throw new comment_exception('invalidcommentarea');
          }
          if ($args->itemid != 0) {
              throw new comment_exception('invalidcommentitemid');
          }
          foreach ($comments as $comment) {
              $comment->strftimeformat = get_string('strftimerecentfull', 'langconfig');
          }
          return $comments;
      }
      

      3) Check that the comments in the comment block now display the year as well as the date/time.

      Show
      1) you need to be a developer to test this as this is an API option that is as yet unused within core. Please read through entire test before commencing. 2) edit the comments block display callback to change the display format in each of the comments (New version) blocks/comments/lib.php: function block_comments_comment_display($comments, $args) { if ($args->commentarea != 'page_comments') { throw new comment_exception('invalidcommentarea'); } if ($args->itemid != 0) { throw new comment_exception('invalidcommentitemid'); } foreach ($comments as $comment) { $comment->strftimeformat = get_string('strftimerecentfull', 'langconfig'); } return $comments; } 3) Check that the comments in the comment block now display the year as well as the date/time.

    Description

      As illustrated in attached screenshot (taken from http://moodle.org/mod/data/view.php?d=13&rid=4124 ) the dates of comments do not include the year. Comments in the modules and plugins database span over several years, and so including the year would be most helpful.

      I've reported this issue as a moodle.org issue, as I don't know whether all sites would want comment dates to include the year, or whether it is better to keep the dates as short as possible.

      Edited to add: On reflection, I think the dates on comments should be the same as elsewhere in Moodle i.e. including a year, and so have moved the issue from MDLSITE to MDL.

      Attachments

        Issue Links

          Activity

            People

              nebgor Aparup Banerjee
              tsala Helen Foster
              Damyon Wiese Damyon Wiese
              Mark Nelson Mark Nelson
              Amaia Anabitarte, Bas Brands, Carlos Escobedo, Laurent David, Sabina Abellan, Sara Arjona (@sarjona)
              Votes:
              4 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                11/Mar/13