I\'m setting up a mat-datepicker for DOB and traditionally the display format is MM/DD/YYYY,I need to change it to DD/MM/YYYY with less coding
I tried format tag in mat
I got it working after combining some knowledge from various answers here, so I thought I'd consolidate what worked for me.
In your module, import MAT_DATE_LOCALE and add it to providers:
import { MAT_DATE_LOCALE } from '@angular/material/core'
@NgModule({
declarations: [...],
imports: [...],
exports: [...],
providers: [
{ provide: MAT_DATE_LOCALE, useValue: 'en-GB' }
]
})
If you use a shared module to import material this will change all the formats of your datepickers across the site.