-
Notifications
You must be signed in to change notification settings - Fork 749
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Duration#normalize
has trouble with negative milliseconds
#1233
Labels
Comments
Possibly unrelated: I would also expect > luxon.Duration.fromObject({days: 777}).normalize()
...
values: {days: 777}
> luxon.Duration.fromObject({milliseconds: 15900}).normalize()
...
values: {milliseconds: 15900} |
Yeah, that could definitely use some improvements |
@icambron Can I solve this issue? |
@CristiMacovei sure |
Closed
@icambron Can you please assign this to me? Thanks. |
thomassth
added a commit
to thomassth/luxon
that referenced
this issue
Jun 29, 2023
thomassth
added a commit
to thomassth/luxon
that referenced
this issue
Jun 29, 2023
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Describe the bug
Fails to normalize a Duration with negative milliseconds.
To Reproduce
I was able to repro this in the playground in the docs:
I would expect the above to be {seconds: 15, milliseconds: 900, minutes: 0}
Out of curiosity, I tried the initializing the "right" duration, and it has no issues normalizing:
Actual vs Expected behavior
Since the overall duration is greater than zero, I expect all normalized fields to be greater than zero.
Desktop (please complete the following information):
Additional context
This library is excellent, by the way!
The text was updated successfully, but these errors were encountered: