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

Restrict activity available until date incorrectly sets offset by the difference between user's timezone and Moodle timezone when saved

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      1. Enable conditional activities
      2. Create new activity as user with different profile timezone than Moodle global timezone setting
      2. View restrict dates shown on course page

      Show
      1. Enable conditional activities 2. Create new activity as user with different profile timezone than Moodle global timezone setting 2. View restrict dates shown on course page
    • Affected Branches:
      MOODLE_20_STABLE

      Description

      When a user sets the available until date for an activity the timestamp value is set to 23:59:59 using strtotime() before it is saved. This causes the date value to be offset by the difference between the creators timezone and what appears to be the Moodle timezone. When the creator then views the activity, instead of showing the available from and until dates it shows the from date and the available until date + or - the time zone offset, for example:

      A user with profile timezone set to Australia/Adelaide where Moodle timezone is set to Australia/Melbourne creates a new activity with restrict dates set to '18 August 2011' until '19 August 2011' will save and display as:
      Restricted: 'Available from 18 August 2011 to 19 August 2011, 11:29 PM.'

      Attached is a patch with a potential solution that replaces strtotime with the make_timestamp() and date() functions.

      Luke

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: