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

Previous/Next month calculation wrong in three-month view

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.4
    • Fix Version/s: 3.4
    • Component/s: Calendar
    • Labels:
    • Testing Instructions:
      Hide

      This isn't the easiest to test. This code is historically in the renderer, and because it relates to dates and it's the dates that can be fruity, there no decent way to write a unit test, short of checking every single potential combination.

      I've written a quick test which runs through every day between 1/1/1970, and 31/12/2200 and confirms that the months are correct using the same code as supplied in the patch (but pulled out).

      1. Open the Calendar
      2. Click the "Calendar" link in breadcrumbs
        1. Confirm that the previous, current, and next months are shown
      3. Download https://gist.github.com/6dcb1811ecba88bdd89b5a1ba24ec7b0 and place in your dirroot
      4. Run is (CLI)
        1. Confirm that it only printed out a list of years, and did not print out any objects
      Show
      This isn't the easiest to test. This code is historically in the renderer, and because it relates to dates and it's the dates that can be fruity, there no decent way to write a unit test, short of checking every single potential combination. I've written a quick test which runs through every day between 1/1/1970, and 31/12/2200 and confirms that the months are correct using the same code as supplied in the patch (but pulled out). Open the Calendar Click the "Calendar" link in breadcrumbs Confirm that the previous, current, and next months are shown Download https://gist.github.com/6dcb1811ecba88bdd89b5a1ba24ec7b0 and place in your dirroot Run is (CLI) Confirm that it only printed out a list of years, and did not print out any objects
    • Affected Branches:
      MOODLE_34_STABLE
    • Fixed Branches:
      MOODLE_34_STABLE
    • Pull Master Branch:
      MDL-60635-master

      Description

      When viewing the last day of a month with 31 days, it appears that something is getting the month calculation wrong and we end up with a three-month view of the calendar which has the same month twice. For example: October, October, November; instead of September, October, November.

      When I originally converted this view to use a template, I stripped out some old code which I didn't think was required. Apparently it was.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                13/Nov/17