Reputation: 5196
$("#dob").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: 'dd-M-yy',
yearRange: '-90:-15'
});
At year dropdown calender filled with range 1922-1997 and showing 1922 as initial value.
But still when I pick a date from this calender , it shows 2012 in textbox field, why?.
Upvotes: 1
Views: 1191
Reputation: 5196
$("#dob").datepicker("option", "defaultDate", '-90y');
Secondly one can also place defauleDate as below
$("#dob").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: 'dd-M-yy',
yearRange: '-90:-15',
defaultDate:'-90y'
});
Upvotes: 5
Reputation: 38478
yearRange
option is not used for displaying default date. It just sets the limits of the years you can choose.
You can set the value when displaying the page from server side or use the defaultDate
option.
Upvotes: 1