Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-10088

Calendar in date picker gets week numbers wrong

XMLWordPrintable

      The calendar in the date picker numbers weeks (along the left). However it gets the week numbers wrong. It seems to be trying to implement the numbering scheme described in ISO-8601 (see this summary):

      /** Returns the number of the week in year, as defined in ISO 8601. */
      Date.prototype.getWeekNumber = function() {
          var d = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
          var DoW = d.getDay();
          d.setDate(d.getDate() - (DoW + 6) % 7 + 3); // Nearest Thu
          var ms = d.valueOf(); // GMT
          d.setMonth(0);
          d.setDate(4); // Thu in Week 1
          return Math.round((ms - d.valueOf()) / (7 * 864e5)) + 1;
      };
      

      However it seems to be buggy (see for example week numbers in 2004).

      update:
      There is a workaround for this issue in 3.13.x and 4.0.x. Thanks to Bettina Zucker for this solution. See the comment here.

            mlassau Mark Lassau (Inactive)
            7ee5c68a815f Jeff Turner
            Votes:
            10 Vote for this issue
            Watchers:
            17 Start watching this issue

              Created:
              Updated:
              Resolved: