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

Custom user profile date fields incorrectly save date

    XMLWordPrintable

Details

    • MOODLE_24_STABLE, MOODLE_25_STABLE, MOODLE_26_STABLE, MOODLE_27_STABLE, MOODLE_28_STABLE
    • MOODLE_26_STABLE, MOODLE_27_STABLE
    • MDL-46676_master
    • Hide

      Set default timezone to UTC
      Set user timezone to Australia/Perth
      Add custom profile datetime field
      Edit profile, select date/time and save
      Check the display in View Profile matches what was saved.

      Show
      Set default timezone to UTC Set user timezone to Australia/Perth Add custom profile datetime field Edit profile, select date/time and save Check the display in View Profile matches what was saved.

    Description

      This is dependent on the server/PHP timezone being set to something other than UTC - in our case it was Australia/Perth
      1. Add a custom profile field for date only;
      2. Edit a user profile, select a date for the custom field and save;
      3. View the profile - the date will be a day earlier

      The issue lies in /user/profile/field/datetime/field.class.php edit_save_data_preprocess() method is using PHP date function rather than moodle's userdate function.

      Attachments

        Activity

          People

            ikawhero Shane Elliott
            ikawhero Shane Elliott
            Adrian Greeve Adrian Greeve
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Frédéric Massart Frédéric Massart
            David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              8/Sep/14