angular-l10n
angular-l10n copied to clipboard
Default Date Format
Hi. Is it possible to set a default date format for the entire project? so I don't need to use it like this in all places?
date | l10nDate: dateLanguage : { day: '2-digit', month: '2-digit', year: 'numeric' }
Thanks in advance!
No, it's not possible. It's weird having to use the date format multiple times, and always with the same format in the same app.
You could do it in two ways:
- create and share an object with the options between the components and pass it to the pipe;
- or create your own custom pipe that always passes the same object as options: https://github.com/robisim74/angular-l10n/blob/master/projects/angular-l10n/src/lib/pipes/l10n-date.pipe.ts