我無法理解如何設置jquery Datepicker的最小/最大日期。當我檢查docs時,我看到dateformat
預計在new Date(2009, 1 - 1, 26)
。 1-1
是什麼意思?當我爲js dateformats學校w3c,我無法找到這個。設置最小/最大日期jquery Datepicker
所以,我想
$("#datepicker").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: 'yyyy-mm',
minDate: new Date(2001-01),
maxDate: '+15Y'
});
但是,這給我留下了完全隨機的結果...它始於2006年,結束2026
這裏是小提琴 http://jsfiddle.net/ANF2y/58/
在JavaScript ['Date'](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Date)對象'month'被計算爲0爲11.設置月份使用'當前月份-1'。 – Pugazh
@Pugazh好的。但爲什麼開始**日期**實現爲'1-1' ?! – Stophface
@Stophface本月而不是日期。 '新日期(年,月,日)' – Rajesh