问题
I'm using JQuery UI Datepicker for users to select their date of birth (DOB). My codes are as follows :-
$('#DOB').datepicker({
changeMonth: true,
changeYear: true,
maxDate: new Date(),
yearRange: '-100:+0'
});
However, I noticed today that since its January, its not showing the rest of the months, (Feb to Dec) unless I changed the year to previous year. I did a temporary solution by adding another option
showMonthAfterYear: true
Its not a perfect fix as its only "pushing" users to select the year before selecting the months. Another solution was to change the options as shown below
yearRange: '-100:-1'
The above 2 temporary solutions might help others but I am hoping for a permanent solution if there is one. Thanks again.
回答1:
I think the issue may be maxDate: new Date(). That sets the maxdate to be today and will hence not show the rest of the months
来源:https://stackoverflow.com/questions/8896907/jquery-ui-datepicker-used-to-select-dob-not-showing-all-months