Skip to content
This repository has been archived by the owner on Jan 1, 2023. It is now read-only.

Gracefully accept more than 9 digits on the seconds fraction #1

Open
addicticks-dev opened this issue Apr 19, 2019 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@addicticks-dev
Copy link
Contributor

In XML Schema type xsd:time and xsd:dateTime can have an unlimited number of digits on the fractional seconds. For example the value

"23:30:28.123456789012345678901234567890Z"

is a perfectly legal xsd:time value according to the XML Schema specification. However, this poses a problem when converting to Java's OffsetDateTime and OffsetTime as these will only allow up to 9 digits precision on the fractional seconds.

Currently parsing a value such as the one above will cause a DateTimeParseException.

The proposal is to able to handle this situation gracefully, meaning that fractional digits after the 9th digit are simply ignored. It is believed that this truncation is always acceptable to all users of the library and is much better than throwing an exception.

The scenario is rare and therefore any solution which handles it must not have adverse performance effect on the 99.99% of date/time values which can be parsed without problems.

@addicticks-dev addicticks-dev added the enhancement New feature or request label Apr 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant