materialize css datepicker options Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of materialize css datepicker options without wasting too much if your time.

The question is published on by Tutorial Guruji team.

// Materialize Date Picker

this.instanceDatepicker = new M.Datepicker(this.elDatepicker.nativeElement, {
        defaultDate: new Date(2018,5,4),
        setDefaultDate: true,
        selectMonths: true,
        selectYears: 200, 
        format: "dd/mm/yyyy"

<input type="text" id="Date" class="datepicker" />

In the options listed above, defaultDate and setDefaultDate fail to show the desired date populated in the input. Anything that I may be doing wrong or is this buggy?


Add these lines and it will work

var $input = $('.datepicker').pickadate();
var picker = $input.pickadate('picker');
picker.set('select', new Date(2018, 5, 4));
We are here to answer your question about materialize css datepicker options - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji