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

Volkan Yazici vyazici at openjdk.org
Fri Aug 15 09:12:13 UTC 2025


On Thu, 14 Aug 2025 23:49:25 GMT, Naoto Sato <naoto at openjdk.org> wrote:

>> `Instant.parse()` is expected to use the offset zone pattern `+HH:mm:ss` (as defined by `DateTimeFormatterBuilder.appendOffsetId()`), but it fails to parse hour-only offsets such as `+02`. This is because the actual implementation uses `+HH:MM:ss` as the pattern. While replacing the pattern in the implementation as with the specification would allow hour-only offsets, it would also introduce compatibility issues, i.e., printing would omit the minutes field when it is zero. So, it is preferable to update the specification to match the implementation. A CSR has also been drafted for this change.
>
> Naoto Sato has updated the pull request incrementally with one additional commit since the last revision:
> 
>   test cases

Thanks for adding the tests. In its current state, it LGTM based on my limited understanding. I'll leave the final approval to those more knowledgeable in this area.

src/java.base/share/classes/java/time/format/DateTimeFormatter.java line 1:

> 1: /*

Doesn't copyright year need a bump?

test/jdk/java/time/test/java/time/TestInstant.java line 179:

> 177:             {"2017-01-01T00:00:00.000+0"},
> 178:             {"2017-01-01T00:00:00.000+0:"},
> 179:             {"2017-01-01T00:00:00.000+02:"},

It is nice that leniency allows `0200` (i.e., missing white space), but not `02:` or `02:00:` (i.e., trailing separators).

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

PR Review: https://git.openjdk.org/jdk/pull/26708#pullrequestreview-3123312615
PR Review Comment: https://git.openjdk.org/jdk/pull/26708#discussion_r2278580535
PR Review Comment: https://git.openjdk.org/jdk/pull/26708#discussion_r2278597174


More information about the i18n-dev mailing list