Closed
Description
Code which crashes:
Instant.parse("2021-12-27T22:00:00.000+0100")
It works properly with a colon inside the timezone offset
Instant.parse("2021-12-27T22:00:00.000+01:00")
It should allow formats like +01
+01:00
and +0100
but the latter is not working
https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC
Exceptions thrown:
Java:
java.time.format.DateTimeParseException: Text '2021-12-27T22:00:00.000+0100:00' could not be parsed, unparsed text found at index 26
JS:
DateTimeFormatException: DateTimeParseException: Text '2021-12-27T22:00:00.000+0100:00' could not be parsed at index 23: 2021-12-27T22:00:00.000+0100:00, at index: 23
Activity
dkhalanskyjb commentedon Nov 23, 2021
The actual ISO-8601 is more subtle. There are two types of formats defined there: basic and extended ones. The basic formats are basically the extended formats with delimiters removed, like
20211227T220000+0400
. So, the format that you are requesting is the basic format for the offsets. We consistently support the extended formats, but not the basic ones.Closing this issue, as it was already reported, but we would appreciate it if, under the issue I'm closing this in favor of, you shared where you encountered this mixed "extended date-time/basic offset" format.
Duplicate of #139