Bootstrap DatePicker in mm / yyyy format set maximum date

2

I'm using Bootstrap DatePicker in mm / yyyy format, but I'm having trouble setting the longest possible date.


TheCodelookslikethis:

$('#mesVigencia').datepicker({format:"mm/yyyy",
    startView: "months",
    minViewMode: "months",
    language: 'pt-BR'
})



How to set the current month as the largest selectable month?

    
asked by anonymous 20.10.2017 / 14:41

1 answer

1

The maximum becomes today.

$( "#mesVigencia" ).datepicker({
    maxDate: "+0m +0w"
});

Or

$( "#mesVigencia" ).datepicker( "option", "maxDate", "+0m +0w" );

UPDATE

Try to set as var.

var date2 = new Date();

date2.setDate(date2.getDate());

maxDate:date2
    
20.10.2017 / 14:43