$('.DateOfBirth').datepicker({
changeMonth: true,
changeYear: true,
dateFormat: 'dd/mm/yy',
defaultDate: new Date(),
yearRange: "-100:+0"
});
The above code brings a list of years ranging : 2017 to 1917 in the year dropdown of datepicker.
Now when i select a year say 2000 the dropdown sets the year value to 2000 which is correct and it works fine till 2000 but if i select a year before 2000 say 1999 etc the dropdown displays the first year i.e 1917 in dropdown selection, but if i select the date it populates the selected year 1999 date eg 23/08/1999 which is correct but the dropdown still has 1917 displayed on it.
Note : the textbox having the above class and the above code is in a partial view which is displayed on a View.
The month dropdown works perfectly, its just the year dropdown creating problem. Also i removed yearRannge attribute and tried still it doesnt work.
if yearRange = -100:+0 so 1917 is selected if i choose any year before 2000
if yearRange = -100:+100 so if i select 1950 it selects 2050 , if 1970 it selects 2070 and so on.
What I have tried:
I tried calling onselect functions but didnt work for me.