I have a DatePicker minimum year is 2000 and needs to be done so that the minimum year was equal to, well, for example, 1910
$(" .datepicker").datepicker({dateFormat: 'dd.mm.yy', changeYear: true, changeMonth: true});
How to do it?
You can restrict the users from selecting a date within the particular range by specifying MinDate and MaxDate properties. The default value of MinDate property is 1/1/1920 and MaxDate property is 12/31/2120 . Dates that appears outside the minimum and maximum date range will be disabled (blackout).
Steps to add Datepicker – $(document). ready(function(){ $("#setMin,#setMax"). datepicker({ dateFormat: "yy-mm-dd" }); $('#datepicker'). datepicker({ dateFormat: "yy-mm-dd", maxDate:'+1m +10d', minDate: -10 }); });
By default DatePicker has standard height and width (height: '30px' and width: '143px'). You can change this height and width by using height and width property respectively.
Try clicking on year 2000. And then try selecting year again. You should be able to select 1990. And you can repeat that 10 times.
Or, use the yearRange
option. More info here.
Example:
$( ".selector" ).datepicker({ yearRange: '1910:2010' });
Try this:
$(function() {
$( "#datepickerID" ).datepicker({
dateFormat: 'dd/mm/yy',
changeMonth: true,
changeYear: true,
yearRange: '1930:2014'
});
});
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