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

The userdate() function inserts a space before 2-digit days

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.8.2
    • Fix Version/s: 2.0
    • Component/s: Unknown
    • Labels:
      None
    • Affected Branches:
      MOODLE_18_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE

      Description

      In the U.S., numeric dates are usually displayed as %m/%d/%y. On the quiz review screen, the history dates are displaying %d/%m/%y instead (the default language is en_us_utf8).

      We added a quiz.php file to the en_us_utf8 directory, and changed the timestr variable to display the month first. However, we found that 2-digit days are now getting preceded by a space. For instance, we're seeign dates like 09/ 14/07. Single-digit days display fine - e.g. 10/4/07.

      It appears that the userdate() function in lib/moodlelib.php removes leading zeros from days, which is inserting a space before the day if there is no leading zero. This doesn't pose an issue if the day comes first in the format string, but it is a problem with U.S.-formatted dates.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              dougiamas Martin Dougiamas
              Reporter:
              adamann2 Ann Adamcik
              Tester:
              Nobody
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                24/Nov/10