moment / luxon

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

Duration.shiftTo + Duration.normalize returns invalid value #1620

Open Balkonskii opened 5 months ago

Balkonskii commented 5 months ago

Describe the bug Incorrect value when shifting the duration of days and months to years. For duration Duration.fromObject({ months: 12, days: 730 }) when using shiftTo and normalize, an incorrect value is returned.

To Reproduce https://stackblitz.com/edit/jrxvkk?file=src%2Fapp%2Fapp.component.ts,package.json

Actual vs Expected behavior Actual is { "years": 3, "months": 0, "days": 10, "hours": 0, "minutes": 0, "seconds": 0, "milliseconds": 0 }. Expected is { "years": 3 }.

Desktop (please complete the following information):

Additional context Found it in unit test in my app. On luxon@3.4.1 it's pass, but from luxon@3.4.2 it's broken.