-
Notifications
You must be signed in to change notification settings - Fork 728
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
Duration Infinity
is converted to 0
by some methods
#1178
Comments
I'd take fixes for that. What should |
@icambron From my research (note that I haven't purchased the updated, full text of the standard, so I don't have access to read any deviations from what has been published in open drafts) ISO 8601 and its extensions don't address an infinite duration. In an extension, open-ended intervals are defined using So... the direct answer to your question is that, currently, there is no valid ISO representation of an infinite duration. With the above in mind: Perhaps it is sensible to consider infinite durations as invalid, and to create a new enumeration for the (Speaking of enumerations, can you point me to where the ones produced internally are located? It seems useful at minimum, and even necessary in some cases to have access to those enumerations for matching during error-handling and testing, but I didn't find them in a search of the repository.) IMO, while Ultimately, I have a need to represent infinite durations and want a reliable way to know whether a duration is infinite or not. |
Thinking about this a bit more, I agree with this:
They're just not going to work in a consistent way, and we should just ban them. Somewhat embarassingly, there's no enum, they're just strings. For example, in return Duration.invalid("unparsable", `the input "${text}" can't be parsed as ISO 8601`); "unparsable" becomes |
I'm also having trouble representing an infinite duration, my use case is representing a lifetime warranty. Trying to use an open interval |
Describe the bug
Luxon treats
Infinity
as a valid duration, but some methods return0
as the value representation.To Reproduce
Here's an inexhaustive example which demonstrates inconsistency:
Actual vs Expected behavior
The latter methods above should also return a representation of
Infinity
, and not0
.Version information
100.0.4896.88
2.3.1
The text was updated successfully, but these errors were encountered: