2013-10-08 59 views
4

我使用jquery的日期選擇器。當我使用默認值時,它顯示2003年到2023年只有20個值。 我需要增加此值。 當我使用此代碼爲什麼日期選擇器只顯示使用Jquery日期選擇器的20年選項?

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

}); 

它顯示20個值.. 但是當我用這個它沒有顯示,這表明2030年至2050年

$( "#inputBirthDate").datepicker({ 
            changeMonth: true, 
            changeYear: true, 
            minDate: new Date(1990-01-01), 
            maxDate: new Date(2050-01-01), 
            inline: true 
}); 

回答

1

其實你的第一段代碼工作正確。這是datepicker的默認行爲,請檢查此demo and code

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

但是,這可以通過使用以下選項來更改。

yearRange: "-20:+0"