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

Comments API needs to allow plugins to set the date format

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.1, 2.4.1
    • Fix Version/s: 2.4.2
    • Component/s: Comments
    • Testing Instructions:
      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.
    • Affected Branches:
      MOODLE_22_STABLE, MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      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.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  4 Vote for this issue
                  Watchers:
                  8 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    11/Mar/13