On Mon, 18 Aug 2025 19:17:02 GMT, Naoto Sato <na...@openjdk.org> wrote:
>> 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. True, but you have to read further into the `appendOffset` prose to know that the minutes and sections can be present. Using the full pattern would convey more quickly the full syntax being parsed. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26708#discussion_r2283632033