angular-l10n icon indicating copy to clipboard operation
angular-l10n copied to clipboard

Default Date Format

Open Neill83 opened this issue 7 months ago • 1 comments

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!

Neill83 avatar Jun 27 '25 04:06 Neill83

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

robisim74 avatar Jul 14 '25 13:07 robisim74