-
Notifications
You must be signed in to change notification settings - Fork 110
UtcOffset.parse inconsistency #242
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
Comments
Indeed, the representation |
I was surprised because this behavior was replicated even in the native implementation where ZoneOffset.of is not available. So the spec for method is ISO8601 plus "±h"? The docs do not mention this at all: kotlinx-datetime/core/common/src/UtcOffset.kt Lines 39 to 47 in 5a920ea
|
The standard is not very clear about the number of digits in the hours component of time shift. I agree that we can at least document the list of supported formats more precisely, and consider if supporting |
@silverhammermba, since you're the one who encountered this inconsistency, could you explain how it affected you? There's a pull request for custom patterns in parsing and formatting (https://github.com/Kotlin/kotlinx-datetime/pull/251)—would that solve your problem? |
The surprise in the default behavior is the bug, in my opinion. It's easy enough to write a custom parser for this case if needed. In my case I'm working on a client and server. The server was sending the non-standard "+h" format, which was working. When it started sending the (also non-standard) "+h:mm" format the client failed. I ended up just correcting the server to avoid the non-standard cases entirely. If the docs were clearly updated to indicate the one supported non-standard format, that would also be sufficient to call the bug closed. |
Fixed in f83b355 |
Uh oh!
There was an error while loading. Please reload this page.
With version 0.4.0, this passes
This fails
My understanding of the standard is that
+4
should be invalid, but I care more that the parsing is consistent.The text was updated successfully, but these errors were encountered: