RFR: 8364752: Class java.time.Instant cannot parse all ISO 8601 date formats [v6]

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


> `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:

  Update src/java.base/share/classes/java/time/format/DateTimeFormatter.java
  
  Right. Changing to your suggested wording
  
  Co-authored-by: Roger Riggs <Roger.Riggs at Oracle.com>

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/26708/files
  - new: https://git.openjdk.org/jdk/pull/26708/files/7523e344..8bc222af

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=26708&range=05
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=26708&range=04-05

  Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/26708.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/26708/head:pull/26708

PR: https://git.openjdk.org/jdk/pull/26708


More information about the core-libs-dev mailing list