0
I’m using the datepicker da ng-boostrap and I am finding it difficult to format the date that goes to the input after clicking on the desired day:
I would like it to be in format: dd/mm/yyyy.
Follows HTML from input:
<input class="form-control form-control-sm" type="text" ngbDatepicker #d="ngbDatepicker" (click)="d.toggle()" [ngClass]="{ 'is-invalid': enviado && f.dt_inicial.errors?.required }" formControlName="dt_inicial">
Below is how I changed the standard locality of Angular, as well as the import of Ngbmodule:
import { registerLocaleData, DatePipe } from '@angular/common';
import localePt from '@angular/common/locales/pt';
registerLocaleData(localePt);
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
...
imports: [
...
NgbModule
],
providers: [
...
{ provide: LOCALE_ID, useValue: 'pt' }
]
How is your code, Html and Typescript if possible??
– LeAndrade
Leandrade, first thank you for contacting, I changed the query with the codes that involve the Datepicker.
– Alessandro