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

Fix normalize() to handle partially negative inputs #1467

Closed thomassth closed 1 year ago

thomassth commented 1 year ago

Continuing https://github.com/moment/luxon/pull/1296/commits/1b735939d319990e53ed440aaa3a41456488c960

Fix #1233 as well as https://github.com/moment/luxon/issues/781#issuecomment-1008051278

Values like { hours: 96, minutes: 0, seconds: -10 } will be normalized to { hours: 95, minutes: 59, seconds: 50 }

This behavior is consistent with rescale()

Test case provided as per https://github.com/moment/luxon/pull/1296#issuecomment-1267456483

icambron commented 1 year ago

@thomassth thanks!