Return value of DateFormatSymbols.getWeekdays()
Wang Zhuo(Zhuoren)
zhuoren.wz at alibaba-inc.com
Tue Nov 5 06:31:41 UTC 2019
Hi,
I am an engineer from Alibaba, and I have a question for return value of DateFormatSymbols.getWeekdays().
When using DateFormatSymbols.getInstance(Locale.ROOT).getWeekdays(), on JDK13 or JDK11u we get short names, such as Sun, Mon. While I think the return value should be full names, such as Sunday, Monday. The comments of this method also indicate full names.
DateFormatSymbols.java:
/**
* Weekday strings. For example: "Sunday", "Monday", etc. An array
* of 8 strings, indexed by <code>Calendar.SUNDAY</code>,
* <code>Calendar.MONDAY</code>, etc.
* The element <code>weekdays[0]</code> is ignored.
* @serial
*/
String weekdays[] = null;
This issue only exists in Local.ROOT, DateFormatSymbols.getInstance(Locale.US).getWeekdays() returns full names.
I think it makes sense to return full names not short ones for Local.ROOT. What's your opinion?
It seems this issue is caused by abbreviated and wide dayWidth are set the same value in root.xml. I made a patch for this, please also review it http://cr.openjdk.java.net/~wzhuo/getWeekdays//webrev.00/
Regards,
Zhuoren
More information about the jdk-dev
mailing list