Details
-
Bug
-
Resolution: Fixed
-
Major
-
1.2 M1
-
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.