Closed kleopatra closed 11 years ago
I think that is because there is no data in the JDK for "narrow" (at least not in JDK 6). Well at least not yet...
JDK java.text.SimpleDateFormat doesn't (can't) support "narrow" values with 5 pattern letters due to the following spec.
"Text: For formatting, if the number of pattern letters is 4 or more, the full form is used; otherwise a short or abbreviated form is used if available. For parsing, both forms are accepted, independent of the number of pattern letters."
ICU4J SimpleDateFormat has the same spec, but it ignores the spec and supports narrow values with 5 pattern letters.
"(Text): 4 or more pattern letters--use full form, < 4--use short or abbreviated form if one exists." (sample) ""yyyyy.MMMMM.dd GGG hh:mm aaa" ->> 01996.July.10 AD 12:08 PM"
In JDK 8 (b55), a new locale service provider java.util.spi.CalendarDataProvider was added. If JSR 310 needs to support narrow values, it can be extended to support narrow values. But currently no localized resources have narrow values. Both SPI and implementation changes are required.
done.
Closing since Sherman commented it was done.
.. for Text printouts. Or at least not according to doc, from DateTimeFormatter.pattern(String):
"Text: The text style is determined based on the number of pattern letters used. Less than 4 pattern letters will use the short form. Exactly 4 pattern letters will use the full form. Exactly 5 pattern letters will use the narrow form."
According to this, the expected narrow form for a Day-of-week would be the first letter of the long form, actual is the numeric value. Failing test:
Same for month.