transloco
transloco copied to clipboard
Bug(scope): Global options are not retrieved when using the localizeDate method on the service API
Is there an existing issue for this?
- [X] I have searched the existing issues
Which Transloco package(s) are the source of the bug?
Locale
Is this a regression?
No
Current behavior
When using the localizeDate method global options are not used. The problem is that the options parameter has a default value; thus, the getDefaultOptions method is never invoked.
https://github.com/jsverse/transloco/blob/45a02872bf238d42138b06f550b80e17366b226a/libs/transloco-locale/src/lib/transloco-locale.service.ts#L105
Expected behavior
If no options are passed the defaults are used.
Please provide a link to a minimal reproduction of the bug, if you won't provide a link the issue won't be handled.
https://codesandbox.io/p/sandbox/frosty-payne-q55l6p
Transloco Config
provideTranslocoLocale({
localeConfig: {
global: {
date: {
timeStyle: "short",
dateStyle: "short",
},
},
},
defaultLocale: "en-US",
langToLocaleMapping: {
en: "en-US",
es: "es-ES",
},
}),
Browser
No response
Additional context
No response
I would like to make a pull request for this bug
Yes 🚀