JQuery UI Datepicker Used To Select DOB Not Showing All Months

这一生的挚爱 提交于 2019-12-21 18:31:33

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!