Change language of Datepicker of Material Angular 4

Melchia picture Melchia · Aug 17, 2017 · Viewed 44.9k times · Source

How to Change language of Datepicker of Material Angular? I can't find in documentation for Angular material 2. Here is a plunkr https://plnkr.co/edit/unzlijtsHf3CPW4oL7bl?p=preview

<md-input-container>
  <input mdInput [mdDatepicker]="picker" placeholder="Choose a date">
  <button mdSuffix [mdDatepickerToggle]="picker"></button>
</md-input-container>
<md-datepicker #picker></md-datepicker>

Answer

vladernn picture vladernn · May 17, 2018
import {MAT_DATE_LOCALE} from '@angular/material';

&

providers: [{ provide: MAT_DATE_LOCALE, useValue: 'es-ES' }]

Do this in tpv.modules.ts