'Angular Date Pipe en-NZ
I am using the angular date picker and have set the locale to en-NZ in the app module like so.
{
provide: LOCALE_ID,
deps: [LocaleService], //some service handling global settings
useFactory: (LocaleService: { locale: string; }) => LocaleService.locale
},
I am using the shortDateFromat but angular date pipe is not formating to the correct locale.
Expected: 6/9/21
Actual: 9/6/21
It appears that it is always formatting to the en-US locale.
Solution 1:[1]
You can add in your app.module.ts this:
import { LOCALE_ID } from '@angular/core';
...
@NgModule({
providers: [{ provide: LOCALE_ID, useValue: 'en-nz' }],
})
It works for me.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Anna Marquez |