Search code examples
jqueryhtmlcssdatepickermaterialize

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



});

Solution

  • In case of necessity the code to change the language to timepicker.

    $(document).ready(function() {
        $('.timepicker').timepicker({
            i18n: {
                cancel: 'Cancelar',
                clear: 'Limpar',
                done: 'Ok'
            },
            twelveHour : false, // twelve hours, use AM/PM
            autoclose: false  //Close the timepicker automatically after select time
        });
    });