Angularjs-Material how to change language to Md-datepicker English

Asked

Viewed 785 times

3

I’m trying to change the language from Md-datepicker to Portuguese because the days of the week and the months are in English, so it gets confusing for the user... Is there any way to exchange this language? Format the fields to Portuguese? inserir a descrição da imagem aqui

<div flex-gt-xs> <h4>Standard date-picker</h4> <md-datepicker ng-model="ctrl.myDate" md-placeholder="Enter date"></md-datepicker> </div>

1 answer

2


To fix the dates you need to set $mdDateLocaleProvider

gets that way:

.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']; });

Browser other questions tagged

You are not signed in. Login or sign up in order to post.