Skip to content

ISO8601 Timezone offset of format +0100 fails to parse #158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jurmous opened this issue Nov 22, 2021 · 1 comment
Closed

ISO8601 Timezone offset of format +0100 fails to parse #158

jurmous opened this issue Nov 22, 2021 · 1 comment

Comments

@jurmous
Copy link

jurmous commented Nov 22, 2021

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
@dkhalanskyjb
Copy link
Collaborator

dkhalanskyjb commented 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants