I am an Angular beginner, I read the documentation of Angular, and it's hard for such an elementary thing... I want that the dates and other things in my application have the French locale, and not the default 'en-US'...
I started to read this Angular documentation, that seems a little bit incomplete, cause, I did the doc states, and failed:
>...\ClientApp>ng serve --configuration=fr
Configuration 'fr' could not be found in project 'ClientApp'.
OK, now I look on another documentation page on the Date pipe. It states:
{{ value_expression | date [ : format [ : timezone [ : locale ] ] ] }}
but ANY example on how to use the locale
, so, I tried to do it in a test application link, like this {{myDate | date: 'medium': undefined : 'fr'}}
but it displays nothing... I have in the console:
ERROR
Error: InvalidPipeArgument: 'Missing locale data for the locale "fr".' for pipe 'DatePipe'
what else should I do or install to display in Angular a date in the French format?
Angular CLI: 6.1.5
Node: 8.11.1
OS: win32 x64
Angular: 6.1.8
Try adding to your app module the following code
https://angular.io/guide/i18n#i18n-pipes
EDIT: Then if you want to sets this locale as default you need to set the LOCALE_ID injection token as 'fr' like that :
In your app module
Hope it helps