AngularJs-Material how to change the md-datepicker Portuguese language

3

I'm trying to change the language of md-datepicker to Portuguese because the days of the week and months are in English, so it gets confusing to the user ... Is there any way to change this language? Format the fields for Portuguese?

<divflex-gt-xs><h4>Standarddate-picker</h4><md-datepickerng-model="ctrl.myDate" md-placeholder="Enter date"></md-datepicker>

</div>

    
asked by anonymous 25.10.2017 / 14:04

1 answer

2

To fix the dates, you need to configure the $ mdDateLocaleProvider

looks like this:


.config(function($mdDateLocaleProvider) {
   $mdDateLocaleProvider.shortMonths  = ['Jan', 'Fev', 'Mar', 'Abril','Maio', 'Jun', 'Jul','Ago', 'Set', 'Out','Nov','Dez'];
   $mdDateLocaleProvider.Months  = ['Janeiro', 'Fevereiro', 'Março', 'Abril','Maio', 'Junho', 'Julho','Agosto', 'Setembro', 'Outubro','Novembro','Dezembro'];
   $mdDateLocaleProvider.days = ['Domingo','Segunda', 'Terça', 'Quarta', 'Quinta','Sexta', 'Sabado'];
   $mdDateLocaleProvider.shortDays = ['D', 'S', 'T', 'Q', 'Q','S','S'];
  });

    
25.10.2017 / 15:12