Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change language of datepicker in materialize css

I'm trying to change the language of datepicker in materialize css version 0.99.0 actual, but don't work. i tried change the language on * The date picker defaults.in materialize.js but didn't worked too. Someone know how to do this? Thanks.

html:

 <div class="input-field col s6">
                    <input type="date" class="datepicker" id="pickdate">
                    <label for="pickdate">DATA</label>
                </div>

javascript:

    $( document ).ready(function() {
    $('.datepicker').pickadate({
        format: 'dd/mm/yyyy',
        selectMonths: true, // Creates a dropdown to control month
        selectYears: 15 // Creates a dropdown of 15 years to control year



});
like image 800
JS Santana Avatar asked Dec 01 '22 15:12

JS Santana


1 Answers

Setting i18n object to Spanish traslation in materializecss 1.0.0-beta:

$('.datepicker').datepicker({ 
            firstDay: true, 
            format: 'yyyy-mm-dd',
            i18n: {
                months: ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"],
                monthsShort: ["Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Set", "Oct", "Nov", "Dic"],
                weekdays: ["Domingo","Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado"],
                weekdaysShort: ["Dom","Lun", "Mar", "Mie", "Jue", "Vie", "Sab"],
                weekdaysAbbrev: ["D","L", "M", "M", "J", "V", "S"]
            }
        });
like image 154
Daniel Armando Avatar answered Dec 04 '22 10:12

Daniel Armando