alongubkin / angular-datepicker

Angular.js Date/Time Picker
MIT License
291 stars 129 forks source link

Not possible to localize the language #43

Open everflux opened 9 years ago

everflux commented 9 years ago

It seems it is not possible to configure the locale for displaying the month and other labels. I checked the guide http://amsul.ca/pickadate.js/date.htm#translations but it did not work with the angular version.

koop-bremen commented 9 years ago

I got it to work like this (replace the german localization with anything you like):

<input type="text" 
pick-a-date="date" 
placeholder="Bitte ein Datum auswählen" 
pick-a-date-options="{
monthsFull: [ 'Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember' ],
monthsShort: [ 'Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez' ],
weekdaysFull: [ 'Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag' ],
weekdaysShort: [ 'So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa' ],
today: 'Heute',
clear: 'Löschen',
firstDay: 1,
format: 'dddd, dd. mmmm yyyy',
formatSubmit: 'yyyy/mm/dd'
}"/>
hafeyang commented 9 years ago
<input type="text" pick-a-date="dpOpts" />

$scope.dpOpts = angular.extend({},/*some global options,localization options ....*/,/*custom options*/);