JQuery UI Datepicker used to select DOB not showing all months

I am 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, today I noticed that from January of this year he did not show the rest of the months (from February to December), unless I changed the year to the previous year. I made a workaround by adding another option

 showMonthAfterYear: true 

This is not an ideal solution as its β€œpushing” users to select the year before the choice of months. Another solution was to change the settings as shown below.

 yearRange: '-100:-1' 

The above 2 workarounds may help others, but I hope for a permanent solution, if any. Thanks again.

+4
source share
1 answer

I think the problem might be maxDate: new Date (). This sets maxdate for today and therefore will not show the rest of the months

+4
source

Source: https://habr.com/ru/post/1341334/