moment / luxon

⏱ A library for working with dates and times in JS
https://moment.github.io/luxon
MIT License
15.23k stars 730 forks source link

Duration return 60 minutes instead of adding an hour #1480

Closed kl3sk closed 1 year ago

kl3sk commented 1 year ago

Describe the bug Parsing ISO time return a weird result such as "60 minutes"

To Reproduce JS Fiddle

Actual vs Expected behavior returns "6 hours, 60 minutes, 0 seconds" instead of "7 hours, 0 minutes, 0 seconds"

Desktop (please complete the following information):

Additional context Great library 👍

kl3sk commented 1 year ago

My bad with more tests I just realize that certainly intentional, Luxon add hours and minutes on each side.

If it's that fell free to close the issue.

Note: How coud I achieve what I want ?

Edit: If find a working solution for me

icambron commented 1 year ago

you want Duration#normalize(). Fiddle.

kl3sk commented 1 year ago

Ho thanks I missed this one.