Skip to content Skip to sidebar Skip to footer

Changing The Date Format In A Materialize Date Picker Modal

Changing the format inside the text field works perfectly fine, but I was unable to figure out how to change the format inside the modal to 'dd.mm.yyyy'. How can I do this? This is

Solution 1:

Open your materialize.js and look for this code:

    key: "_renderDateDisplay",
    value: function _renderDateDisplay() {
       var displayDate = Datepicker._isDate(this.date) ? this.date : new Date();
       var i18n = this.options.i18n;
       var day = i18n.weekdaysShort[displayDate.getDay()];
       var month = i18n.months[displayDate.getMonth()];
       var date = displayDate.getDate();
      this.yearTextEl.innerHTML = displayDate.getFullYear();
      this.dateTextEl.innerHTML = day + ", " + date + " " + month;
    }

here you can change the order of the format and the type of the date, I mean for example weekdaysShort to weekdays etc.

Post a Comment for "Changing The Date Format In A Materialize Date Picker Modal"