Summary
Predefined ISO 8601 formatters that accept zone offsets should support short zone offsets for parsing
Problem
ISO 8601 allows short format offsets that are hour offsets only. JDK-8032051 fixed ZonedDateTime (ISO_OFFSET_DATE_TIME and BASIC_ISO_DATE formatters) to allow short offsets, and JDK-8364752 fixed ISO_INSTANT as well. However, the other predefined ISO formatters that accept zone offsets remain unfixed.
Solution
For other ISO formatters, perform lenient parsing for the offsets. This should apply to the following formatters:
ISO_DATE
ISO_TIME
ISO_DATE_TIME
ISO_OFFSET_DATE
ISO_OFFSET_TIME
ISO_ORDINAL_DATE
ISO_WEEK_DATE
Specification
Add the following one sentence in the field descriptions of the above formatters in java.time.format.DateTimeFormatter:
* <li>The {@link ZoneOffset#getId() offset ID}. If the offset has seconds then
* they will be handled even though this is not part of the ISO-8601 standard.
+ * The offset parsing is lenient, which allows the minutes and seconds to be optional.
* Parsing is case insensitive.
- csr of
-
JDK-8210336 DateTimeFormatter predefined formatters should support short time zone offsets
-
- In Progress
-