<i18n dev> RFR: 8247781: Day periods support [v7]
Stephen Colebourne
scolebourne at openjdk.java.net
Fri Nov 6 09:14:58 UTC 2020
On Fri, 6 Nov 2020 03:00:52 GMT, Naoto Sato <naoto at openjdk.org> wrote:
>> test/jdk/java/time/tck/java/time/format/TCKDateTimeParseResolver.java line 858:
>>
>>> 856: return new Object[][]{
>>> 857: {STRICT, 0, LocalTime.of(6, 0), 0},
>>> 858: {STRICT, 1, LocalTime.of(18, 0), 1},
>>
>> As mentioned in my other comment, this seems odd in STRICT mode.
>
> Did you mean in STRICT mode, HOUR_OF_AMPM should default to 0, and to 6 in SMART/LENIENT modes?
No. I mean that when resolving AMPM/dayPeriod in strict mode, and there is no HOUR_OF_DAY or HOUR_OF_AMPM, then do not resolve using "half way between"(ie. fail). This will produce a result where `LocalTime` cannot be obtained.
var f = DateTimeFormatter.ofPattern("B").withResolverStyle(ResolverStyle.STRICT);
var t = LocalTime.from("at night", f);
would throw an exception in STRICT mode (whereas SMART or LENIENT would return a `LocalTime`). Same with pattern "a".
-------------
PR: https://git.openjdk.java.net/jdk/pull/938
More information about the i18n-dev
mailing list