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

Date handling can't cope with UTC higher than 12 eg UTC +14 (Pacific/Kiritimati)

    XMLWordPrintable

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.3.9, 2.4.6, 2.5
    • None
    • Libraries
    • None
    • MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE

    Description

      All date handling in moodlelib.php assumes a timezone > 13

      These functions are ones I found that need fixing:
      usergetdate(), date_format_string(), make_timestamp(), usertimezone(), usertime()

      1.9 codebase example from reporter (but this is still an issue in 2.x)

      $usertime = userdate(gmmktime(), get_string('strftimedaydatetime'), "Pacific/Kiritimati" );

      echo $usertime yields: "09/10 22:48"

      When I use the below code, the time is correctly displayed:

      $userDateTime = new DateTime(null, new DateTimeZone("Pacific/Kiritimati"));
      $usertime = $userDateTime->format('m/d H:i');

      echo $usertime yields: "09/10 16:48"

      More discussion on this here:
      https://moodle.org/mod/forum/discuss.php?d=237545

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jlukar John Lukar
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated: