UpdateLocale Plugin does not allow partial updates to locale
Describe the enhancement
While using the UpdateLocale Plugin, it isn't possible to just update one single value in a nested value.
For example I just want to update the format.L value:
dayjs.extend(UpdateLocale);
dayjs.updateLocale('de', {
formats: {
L: 'D.M.YYYY',
},
});
Like this other formats LL, LLL, ... are getting lost.
Expected behavior I want to pass in an object, which updates the locale information partially.
Information
- Day.js Version [e.g. v1.9.1]
- OS: [e.g. iOS]
PS:
If the issue is accepted as a bug/enhancement, I would like to contribute and create a PR for that issue 😃
Agreed. Will update this feature later.
The issue still persists with version "1.11.4". updateLocal drops all other keys from the object.
My workaround:
const relativeTime = {
relativeTime: {
...dayjs.Ls[nextLocale].relativeTime,
future: "custom text",
past: "custom text"
}
};
dayjs.updateLocale(nextLocale, relativeTime);
Trying to fix here https://github.com/iamkun/dayjs/pull/2075 @iamkun