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

setLocale method for Duration #1465

Open lkster opened 1 year ago

lkster commented 1 year ago

Is your feature request related to a problem? Please describe. DateTime has setLocale method as an alias for reconfigure({ locale: string }). Duration just doesn't so we need to use reconfigure:

DateTime.fromISO('2023-07-10T14:52:00').setLocale('en-US');
Duration.fromISO('P2DT1H').reconfigure({ locale: 'en-US' });

Describe the solution you'd like I'd like to be able to set locale in the same way as it is with DateTime:

DateTime.fromISO('2023-07-10T14:52:00').setLocale('en-US');
Duration.fromISO('P2DT1H').setLocale('en-US');

Describe alternatives you've considered Using reconfigure method.