Jquery ui datepicker. How can I show ALL possible years (for date of birth)?

I am using jquery ui datepicker with changeYear. The problem is that it shows years in pieces (from 1985 to 2005, and then to open for several more years in 1985). I need to show ALL the years in the range that I go through like this:

$(".datepickerBDAY_trigger").datepicker({ "dateFormat": "yy-mm-dd", changeMonth: true, changeYear: true, maxDate: "-16Y", minDate: "-100Y" }); 

How can i do this? I can not find this information elsewhere.

thanks

+8
jquery jquery-ui jquery-ui-datepicker datepicker
source share
1 answer

You can use the yearRange option. Its first form ( -nn:+nn ) allows you to specify a range relative to the current year instead of the currently selected year.

 $(".datepickerBDAY_trigger").datepicker({ dateFormat: "yy-mm-dd", changeMonth: true, changeYear: true, maxDate: "-16Y", minDate: "-100Y", yearRange: "-100:-16" }); 

You can see the results in this fiddle .

+15
source share

All Articles