I wanted to implement the datepicker to select the birthdate and I had troubles changing the yearRange
as it doesn't seemed to work with my version (1.5). I updated to the newest jquery-ui datepicker version here: https://github.com/uxsolutions/bootstrap-datepicker.
Then I found out they provide this very helpful on-the-fly tool, so you can config your whole datepicker and see what settings you have to use.
That's how I found out that the option
defaultViewDate
is the option I was looking for and I didn't find any results searching the web.
So for other users: If you also want to provide the datepicker to change the birthdate, I suggest to use this code options:
$('#birthdate').datepicker({
startView: 2,
maxViewMode: 2,
daysOfWeekHighlighted: "1,2",
defaultViewDate: { year: new Date().getFullYear()-20, month: 01, day: 01 }
});
When opening the datepicker you will start with the view to select the years, 20 years ago relative to the current year.