jQuery code
$(function () {
var d = new Date();
var month = d.getMonth();
var range;
if (month == 10 || month == 11) {
range = '-12:+1';
} else {
range = '-12:+0';
}
$('#txtDate').datepicker({
changeMonth: true,
changeYear: true,
yearRange: range
});
});
You can check it working out by changing the condition as if (month == 03 || month == 11)
.
Alternate
$(function () {
var d = new Date();
var month = d.getMonth();
$('#txtDate').datepicker({
changeMonth: true,
changeYear: true,
yearRange: (month == 10 || month == 11) ? '-12:+1' : '-12:+0'
});
});