<i18n dev> RFR: 8364752: Class java.time.Instant cannot parse all ISO 8601 date formats [v5]

Naoto Sato naoto at openjdk.org
Mon Aug 18 19:19:17 UTC 2025


On Mon, 18 Aug 2025 18:12:38 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> Naoto Sato has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   copyright year update
>
> src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java line 3893:
> 
>> 3891:                     .appendFraction(NANO_OF_SECOND, minDigits, maxDigits, true)
>> 3892:                     .parseLenient()
>> 3893:                     .appendOffset("+HH", "Z")
> 
> The "+HH" pattern is supposed to be ignoring minutes and seconds but it does not appear to.  In jshell, I see:
> 
> jshell> Instant.parse("2017-01-01T00:00:00.000-02:10:12")
> $8 ==> 2017-01-01T02:10:12Z
> 
> It would be more consistent with the original pattern to use `"+HH:mm:ss"`

IIUC, "ignoring minutes and seconds" refers to formatting, i.e, "-02:10:12" only prints "-02" Parsing offsets in lenient mode always parses minute/seconds.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/26708#discussion_r2283235663


More information about the i18n-dev mailing list