When i set the minDate var to something below 2001, it just won't go below 2001 for the lower limit.
I've tried inserting the minDate value as a string, number, or Date object (as the documentation says you can use any of all 3 types)
Regardless of how i enter the value, it will not go below 2001.
Any Ideas?
That is due to the fact that if you display the year with the option changeYear
you must also set yearRange that otherwise default at +10:-10
For example:
$( "#datepicker" ).datepicker({
minDate: "-20Y",//go back 20 years
changeYear:true,//show a drop down to change year
maxDate: "+1M +10D",
yearRange: 'c-100:c+10'//Show up to 100 years before and ten years after in the dropdown
});
fiddle here: http://jsfiddle.net/rUq7M/
You may want to like this: The values given here are just for illustration purpose, you need to use values based on your requirements.
$(function () {
$("#datepicker").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: "yy-mm-dd",
yearRange: '1934:2004',
defaultDate: '1980-01-01'
});
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With