Skip to content
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

xsd:dateTime, xsd:time coercion is incorrect for fractional seconds #580

Closed
mpoffald opened this issue Sep 26, 2023 · 0 comments · Fixed by #583
Closed

xsd:dateTime, xsd:time coercion is incorrect for fractional seconds #580

mpoffald opened this issue Sep 26, 2023 · 0 comments · Fixed by #583
Assignees
Labels
bug Something isn't working as expected

Comments

@mpoffald
Copy link
Contributor

As predicted by this comment: #421 (comment), our strategy for converting decimal seconds to nanoseconds is incorrect. It only works with exactly 3 digits.

The following cases fail:

;;4 digits: errors
(datatype/coerce "11:14:32.8331Z" const/$xsd:time)
;;=>  error: java.lang.ArithmeticException: integer overflow
(datatype/coerce "2021-09-24T11:14:32.8331" const/$xsd:dateTime)
;;=>  error: java.lang.ArithmeticException: integer overflow

;;2 digits: values are incorrect
(datatype/coerce "11:14:32.83Z" const/$xsd:time)
;;=> #object[java.time.OffsetTime 0x7dcfbb4a "11:14:32.083Z"
(datatype/coerce "2021-09-24T11:14:32.83" const/$xsd:dateTime)
;;=>     #object[java.time.LocalDateTime 0x3260de9d "2021-09-24T11:14:32.083"]
@mpoffald mpoffald added the bug Something isn't working as expected label Sep 26, 2023
@mpoffald mpoffald self-assigned this Sep 26, 2023
mpoffald added a commit that referenced this issue Sep 26, 2023
Fixes #580

The built-in java parsers will do the correct thing for subsecond values. We don't need to be doing any manual string-inspecting apart from determining whether an offset is present.
mpoffald added a commit that referenced this issue Sep 28, 2023
Fixes #580

The built-in java parsers will do the correct thing for subsecond values. We don't need to be doing any manual string-inspecting apart from determining whether an offset is present.
mpoffald added a commit that referenced this issue Sep 28, 2023
Fixes #580

The built-in java parsers will do the correct thing for subsecond values. We don't need to be doing any manual string-inspecting apart from determining whether an offset is present.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant