jQuery UI: Datepicker for birth date input July 11, 2009
I decided to use jQuery UI Datepicker control for one of project and faced with the some strange behavior. At first, I decided to find a way to select month and year quickly because switching months with previous button will unhappy every user. So I’ve added the following options:
changeMonth: true,
changeYear: true
});
Well it’s much better already but here I found that not much years are displayed in the dropdown – only from 1999 to 2019. I spent about minute to find out that range changes when I select year. So it shows -10 year as down date and +10 years as up value (from client I just got email that he cannot select his birth year so I bet whether this logic of work is useful).
To set fixed range of years in dropdown you need to use yearRange option. For instance, in my case it is:
changeMonth: true,
changeYear: true,
yearRange: ‘1910:2000′
});
Another interesting thing is that datepicker doesn’t allow me to select my birth day :) When I select March 1983 it shows days from 1 to 5 only:

My name is Alexander Kleshchevnikov. I have been working as a professinal web application developer since 2002. I believe in simple intelligence from server technologies to front-end development. Now I run my own web development consulting company in Ukraine. You can find
Leave a Reply