Take a look at my fiddle .
I have a month ticker that allows users to select a year in advance, but I want the last months to be turned off, and also a few months after a year to be turned off, but I canโt figure out how to do this.
Example scenario The current month is October, so for the โyear 2015โ the months โJanuary to Septemberโ will be disabled and the months from November to December will be disabled for โ2016โ
I tried using minDate: "0" and maxDate: "1y", but they do not work.
HTML
<div class="input-group date" style="width: 200px"> <input type="text" id="example1" class="form-control" style="cursor: pointer"/> <span class="input-group-addon"> <i class="glyphicon glyphicon-calendar"></i> </span> </div>
JQuery
$('#example1').datepicker ({ format: "MM yyyy", minViewMode: 1, autoclose: true, startDate: new Date(new Date().getFullYear(), '0', '01'), endDate: new Date(new Date().getFullYear()+1, '11', '31') });
source share