Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-1814

Day period incorrectly computed

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 1.2 M2
    • 1.2 M1
    • Statistics
    • None
    • any
    • day, period, stats, statistics, PERIOD_DAY, Calendar

    Description

      The day period (@see com.xpn.xwiki.stats.impl.XWikiStats#PERIOD_DAY) is incorrectly computed in

      {@link com.xpn.xwiki.stats.impl.XWikiStats#getPeriodAsInt(Date, int)}

      . The problem is related to the inconsistent implementation of

      {@link java.util.Calendar}

      . More precisely, in Calendar we have the following:

      public static final int DAY_OF_MONTH
      Field number for get and set indicating the day of the month. This is a synonym for DATE. The first day of the month has value 1.

      public static final int MONTH
      Field number for get and set indicating the month. This is a calendar-specific value. The first month of the year is JANUARY which is 0; the last depends on the number of months in a year.

      Currently, for a date like 'October 18th, 2007" the getPeriodAsInt(date, XWikiStats.PERIOD_DAY) returns 20071019, which is wrong.

      Attachments

        Activity

          People

            vmassol Vincent Massol
            mflorea Marius Dumitru Florea
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: