Moodle
  1. Moodle
  2. MDL-34708

Date Picker popup incorrect dates

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.4, 2.3.1
    • Fix Version/s: 2.2.5, 2.3.2
    • Component/s: Forms Library
    • Labels:
    • Database:
      MySQL
    • Testing Instructions:
      Hide

      Test according to MDL-31622's test but this time add a sub step between 3 and 4.

      3(a) test the popup calendar translates the correct days in other timezones too. (+0800 hours, -0800 hours etc)

      Show
      Test according to MDL-31622 's test but this time add a sub step between 3 and 4. 3(a) test the popup calendar translates the correct days in other timezones too. (+0800 hours, -0800 hours etc)
    • Affected Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE
    • Pull from Repository:
    • Pull Master Branch:
    • Rank:
      43170

      Description

      The pop-up date picker shows an incorrect calendar and the days are starting at Saturday and running until Friday for some reason.

      I'm using the en_us language pack. See the screenshot, it has August 1st listed as a Tuesday and not a Wednesday. I'm running Moodle 2.3.1+. This is also happening on Moodle 2.2.4+. This does NOT occur on the latest Moodle 2.1.7+.

        Issue Links

          Activity

          Hide
          Michael de Raadt added a comment -

          Hi, Ryan.

          I wonder if there is an element of timezones coming into this. What you are describing looks like a shift in time.

          What are your timezone settings?

          On my system the calendar is correct and on screenshots on other date related issues, the days start on Sunday and the calendar looks correct.

          I tried playing with my timezone to see if that changed the display of the calendar, but it didn't.

          I couldn't find a recent change that might be responsible for a regression.

          Any clues you could provide would be great.

          Show
          Michael de Raadt added a comment - Hi, Ryan. I wonder if there is an element of timezones coming into this. What you are describing looks like a shift in time. What are your timezone settings? On my system the calendar is correct and on screenshots on other date related issues, the days start on Sunday and the calendar looks correct. I tried playing with my timezone to see if that changed the display of the calendar, but it didn't. I couldn't find a recent change that might be responsible for a regression. Any clues you could provide would be great.
          Hide
          Ryan Smith added a comment -

          The timezone is set to the server's local time, which is the default. I'm in the EDT zone, which is America/New York.

          The problem was spotted by a user on our production site, so to test, I installed clean copies of 2.3.1+, 2.2.4+, and 2.1.7+ on a VM. I selected the en_us language at install. The problem occurs on the 2.3.1+ and 2.2.4+, but not the 2.1.7+.

          Where does Moodle detect the local server time zone from? The PHP timezone settings?

          The actual Moodle calendar is correct across all the versions. This is only happening with the pop-up date picker.

          Show
          Ryan Smith added a comment - The timezone is set to the server's local time, which is the default. I'm in the EDT zone, which is America/New York. The problem was spotted by a user on our production site, so to test, I installed clean copies of 2.3.1+, 2.2.4+, and 2.1.7+ on a VM. I selected the en_us language at install. The problem occurs on the 2.3.1+ and 2.2.4+, but not the 2.1.7+. Where does Moodle detect the local server time zone from? The PHP timezone settings? The actual Moodle calendar is correct across all the versions. This is only happening with the pop-up date picker.
          Hide
          Matthew Davidson added a comment -

          This is a regression bug from MDL-31622

          The formlib.php code change is hard coded to describe M-F and Jan-Feb using numbers like:
          'mon' => strftime('%a', 360000), // 5th Jan 1970 at 12pm

          This isn't working, but when I change it to this it works (and makes more sense):
          'mon' => strftime('%a', strtotime("Monday")),

          I will post to the original bug and make my code suggestions there.

          Show
          Matthew Davidson added a comment - This is a regression bug from MDL-31622 The formlib.php code change is hard coded to describe M-F and Jan-Feb using numbers like: 'mon' => strftime('%a', 360000), // 5th Jan 1970 at 12pm This isn't working, but when I change it to this it works (and makes more sense): 'mon' => strftime('%a', strtotime("Monday")), I will post to the original bug and make my code suggestions there.
          Hide
          Vernellia Randall added a comment -

          This is not a minor issue. When you are doing a lot of workshops to remember to set the dats over. The problem seems to be quite simple. The labeling of the columns is incorrect. If you change the labeling to read Sunday to Saturday than the dates would be

          Show
          Vernellia Randall added a comment - This is not a minor issue. When you are doing a lot of workshops to remember to set the dats over. The problem seems to be quite simple. The labeling of the columns is incorrect. If you change the labeling to read Sunday to Saturday than the dates would be
          Hide
          Aparup Banerjee added a comment -

          Thanks for the report and fix
          '* at 12pm' - yes that is going to cause issues, i've put up the suggested fix on github.

          Show
          Aparup Banerjee added a comment - Thanks for the report and fix '* at 12pm' - yes that is going to cause issues, i've put up the suggested fix on github.
          Hide
          Sam Hemelryk added a comment -

          Thanks for the report and thanks for fixing Apu. This has been integrated now.

          Show
          Sam Hemelryk added a comment - Thanks for the report and thanks for fixing Apu. This has been integrated now.
          Hide
          Adrian Greeve added a comment -

          Tested with the following languages:

          • French
          • Arabic
          • Korean
          • Japanese
          • Mandarin (Taiwanese)
            Dates seems to be displaying correctly.
            Test passed.
          Show
          Adrian Greeve added a comment - Tested with the following languages: French Arabic Korean Japanese Mandarin (Taiwanese) Dates seems to be displaying correctly. Test passed.
          Hide
          Aparup Banerjee added a comment -

          and across timezones too, thanks for testing Adrian

          Show
          Aparup Banerjee added a comment - and across timezones too, thanks for testing Adrian
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Fixed STOP Closed STOP Thanks STOP

          Yay, imagination! Ciao

          Show
          Eloy Lafuente (stronk7) added a comment - Fixed STOP Closed STOP Thanks STOP Yay, imagination! Ciao
          Hide
          Michael Spall added a comment -

          There still seems to an issue in the date picker. I have filed this issue MDL-35171

          Show
          Michael Spall added a comment - There still seems to an issue in the date picker. I have filed this issue MDL-35171
          Hide
          Matthew Davidson added a comment -

          http://tracker.moodle.org/browse/MDL-35171 is a regression bug from my code.

          According to https://bugs.php.net/bug.php?id=49115 the code in formslib.php should be changed to

          $config = array(array(
          'firstdayofweek' => get_string('firstdayofweek', 'langconfig'),
          'mon' => strftime('%a', strtotime("Monday")),
          'tue' => strftime('%a', strtotime("Tuesday")),
          'wed' => strftime('%a', strtotime("Wednesday")),
          'thu' => strftime('%a', strtotime("Thursday")),
          'fri' => strftime('%a', strtotime("Friday")),
          'sat' => strftime('%a', strtotime("Saturday")),
          'sun' => strftime('%a', strtotime("Sunday")),
          'january' => strftime('%B', strtotime("January 1")),
          'february' => strftime('%B', strtotime("February 1")),
          'march' => strftime('%B', strtotime("March 1")),
          'april' => strftime('%B', strtotime("April 1")),
          'may' => strftime('%B', strtotime("May 1")),
          'june' => strftime('%B', strtotime("June 1")),
          'july' => strftime('%B', strtotime("July 1")),
          'august' => strftime('%B', strtotime("August 1")),
          'september' => strftime('%B', strtotime("September 1")),
          'october' => strftime('%B', strtotime("October 1")),
          'november' => strftime('%B', strtotime("November 1")),
          'december' => strftime('%B', strtotime("December 1"))
          ));

          Show
          Matthew Davidson added a comment - http://tracker.moodle.org/browse/MDL-35171 is a regression bug from my code. According to https://bugs.php.net/bug.php?id=49115 the code in formslib.php should be changed to $config = array(array( 'firstdayofweek' => get_string('firstdayofweek', 'langconfig'), 'mon' => strftime('%a', strtotime("Monday")), 'tue' => strftime('%a', strtotime("Tuesday")), 'wed' => strftime('%a', strtotime("Wednesday")), 'thu' => strftime('%a', strtotime("Thursday")), 'fri' => strftime('%a', strtotime("Friday")), 'sat' => strftime('%a', strtotime("Saturday")), 'sun' => strftime('%a', strtotime("Sunday")), 'january' => strftime('%B', strtotime("January 1")), 'february' => strftime('%B', strtotime("February 1")), 'march' => strftime('%B', strtotime("March 1")), 'april' => strftime('%B', strtotime("April 1")), 'may' => strftime('%B', strtotime("May 1")), 'june' => strftime('%B', strtotime("June 1")), 'july' => strftime('%B', strtotime("July 1")), 'august' => strftime('%B', strtotime("August 1")), 'september' => strftime('%B', strtotime("September 1")), 'october' => strftime('%B', strtotime("October 1")), 'november' => strftime('%B', strtotime("November 1")), 'december' => strftime('%B', strtotime("December 1")) ));
          Hide
          Michael de Raadt added a comment -

          Thanks for following up on this, guys.

          Show
          Michael de Raadt added a comment - Thanks for following up on this, guys.

            People

            • Votes:
              4 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: