我无法理解如何设置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