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

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Major Major
    • None
    • 2.3.9, 2.4.6, 2.5
    • Libraries
    • None
    • MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE

      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

            Unassigned Unassigned
            jlukar John Lukar
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.