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

Calendar end of month miscalculated when Daylight Savings changes

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.7.3
    • Fix Version/s: None
    • Component/s: Calendar
    • Labels:
      None
    • Affected Branches:
      MOODLE_27_STABLE

      Description

      The mini calendar does not correctly display for the months in which Daylight Savings changes.

      For example, for the month of November, the calendar will start at Nov 1, 00:00:00 local time and end Nov 30, 22:59:59 local time.

      This is caused by the display->tend calculation which starts with the display->tstart time and adds the number of seconds for the number of calendar days in the month. However, when DST changes in a month, the number of seconds in that month will be off by an hour either direction.

      The mini calendar instance of the miscalculation points to a larger problem in moodle for calculating the end of a month. For example, I see this type of logic in calendar\export_execute.php among others.

      Succinctly, if the end of a day, month, year is calculated based on the standard length of a day (usually using DAYSECS), then end of the period will be incorrect for any period including a Daylight Savings change.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              pjking07 PJ King
              Participants:
              Component watchers:
              Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: