In my app.module.ts I added this code:
import { NgModule, LOCALE_ID } from '@angular/core';
import it from '@angular/common/locales/it';
import { registerLocaleData } from '@angular/common';
registerLocaleData(it);
//inside here I got all the necessary imports that I will not write here to avoid confusion
@NgModule({
declarations: [
],
imports: [
],
providers: [{ provide: LOCALE_ID, useValue: "it-IT" }],
bootstrap: []
})
Inside my html I have
<dd *ngIf="rec.DATECREATE" class="col-sm-8">{{rec.DATECREATE | date:'dd/MM/yyyy hh:mm:ss'}}</dd>
I get this error
Error: InvalidPipeArgument: 'Unable to convert "giu 22, 2021 11:14:38 AM" into a date' for pipe 'DatePipe'
if I try to replace giu with jun at runtime I don't get any error so the problem should be that it tries to use English instead of Italian. I think it does not read what I defined in my app.module.ts, how to fix this?