A DESCRIPTION OF THE PROBLEM :
In the DateFormatSymbols class, the weekday-related methods always refer to the Calendar constants. As an example for getWeekdays:
Returns:
the weekday strings. Use Calendar.SUNDAY, Calendar.MONDAY, etc. to index the result array.
However, the month-related methods don't refer to the Calendar constants for indexing, so it took me a long time to find out why the months array has length 13.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
getMonths
@returns the month strings. Use Calendar.JANUARY, Calendar.FEBRUARY, etc. to index the result array.
setMonths
@param newMonths the new month strings. The array should be indexed by Calendar.JANUARY, Calendar.FEBRUARY, etc.
getShortMonths
@returns the short month strings. Use Calendar.JANUARY, Calendar.FEBRUARY, etc. to index the result array.
setShortMonths
@param newMonths the new short month strings. The array should be indexed by Calendar.JANUARY, Calendar.FEBRUARY, etc.
ACTUAL -
getMonths
@returns the month strings.
setMonths
@param newMonths the new month strings.
getShortMonths
@returns the short month strings.
setShortMonths
@param newMonths the new short month strings.
URL OF FAULTY DOCUMENTATION :
http://docs.oracle.com/javase/8/docs/api/java/text/DateFormatSymbols.html
In the DateFormatSymbols class, the weekday-related methods always refer to the Calendar constants. As an example for getWeekdays:
Returns:
the weekday strings. Use Calendar.SUNDAY, Calendar.MONDAY, etc. to index the result array.
However, the month-related methods don't refer to the Calendar constants for indexing, so it took me a long time to find out why the months array has length 13.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
getMonths
@returns the month strings. Use Calendar.JANUARY, Calendar.FEBRUARY, etc. to index the result array.
setMonths
@param newMonths the new month strings. The array should be indexed by Calendar.JANUARY, Calendar.FEBRUARY, etc.
getShortMonths
@returns the short month strings. Use Calendar.JANUARY, Calendar.FEBRUARY, etc. to index the result array.
setShortMonths
@param newMonths the new short month strings. The array should be indexed by Calendar.JANUARY, Calendar.FEBRUARY, etc.
ACTUAL -
getMonths
@returns the month strings.
setMonths
@param newMonths the new month strings.
getShortMonths
@returns the short month strings.
setShortMonths
@param newMonths the new short month strings.
URL OF FAULTY DOCUMENTATION :
http://docs.oracle.com/javase/8/docs/api/java/text/DateFormatSymbols.html