Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why date picker showing only 20 year in option using Jquery date picker?

I am using date picker of jquery .As i use default it show year 2003 to 2023 only 20 values . I need to increase this value . when i use this code

 $(  "#inputBirthDate" ).datepicker({
                                     changeMonth: true,
                                     changeYear: true,

});

it show 20 values .. BUt when I used this it is not showing, it show 2030 to 2050

  $(  "#inputBirthDate" ).datepicker({
                                     changeMonth: true,
                                     changeYear: true,
                                     minDate: new Date(1990-01-01),
                                     maxDate: new Date(2050-01-01),
                                     inline: true
});
like image 684
user2075328 Avatar asked Oct 08 '13 06:10

user2075328


2 Answers

You can set the year range using this option per documentation here http://api.jqueryui.com/datepicker/#option-yearRange

yearRange: '1950:2013', // specifying a hard coded year range

or this way

yearRange: "-100:+0", // last hundred years
like image 104
Neel Avatar answered Oct 19 '22 11:10

Neel


Actually your first piece of code is working correct. This is the default behavior of datepicker, check this demo and code.

min: current year -10 (2013 - 10 = 2003)
max: current year +10 (2013 + 10 = 2023)

However this can be cahanged using the following option.

 yearRange: "-20:+0"
like image 27
Praveen Avatar answered Oct 19 '22 12:10

Praveen