Closed SchneMa closed 4 years ago
Hi @SchneMa,
PARSE_DATE_STYLE
is not an injection token, so you cannot override it through dependency injection.
The simplest way is to build your custom options, e.g.:
shortDateOptions: L10nDateTimeFormatOptions = {
year: 'numeric',
month: '2-digit',
day: '2-digit'
};
and pass them to pipes/directives:
<p>{{ today | l10nDate:locale.language:shortDateOptions }}</p>
If you prefer, you can also put them in an injection token and pass them to the components that use them.
Thank you for your help!
Works like a charm!
I just wanted to extend the short date format to use 2 digital values for month and day with leading zeros but I'm unable to overwrite the PARSE_DATE_STYLE constant. I tryed it by passing a custom provider to
platformBrowserDynamic
but it seems to be overwritten somewhere else.Am I missing something or shouldn't this be the way to overwrite the default value.
Thanks in advance!