JQuery UI日期选择器minDate和日期范围看起来很漂亮 [英] JQuery UI Date Picker minDate and Date Range Seemingly Pretty Broken
本文介绍了JQuery UI日期选择器minDate和日期范围看起来很漂亮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我将minDate var设置为低于2001的值时,它不会低于2001年的下限。
When i set the minDate var to something below 2001, it just won't go below 2001 for the lower limit.
我尝试插入minDate值作为字符串,数字或Date对象(文档说您可以使用3种类型中的任何一种)
I've tried inserting the minDate value as a string, number, or Date object (as the documentation says you can use any of all 3 types)
无论我输入的值如何,都不会
Regardless of how i enter the value, it will not go below 2001.
任何想法?
推荐答案
事实上,如果您使用选项 changeYear
显示年份,您还必须设置 yearRange ,否则默认为+10:-10
例如:
That is due to the fact that if you display the year with the option changeYear
you must also set yearRange that otherwise default at +10:-10
For example:
$( "#datepicker" ).datepicker({
minDate: "-20Y",//go back 20 years
changeYear:true,//show a drop down to change year
maxDate: "+1M +10D",
yearRange: 'c-100:c+10'//Show up to 100 years before and ten years after in the dropdown
});
这里的小提琴: http://jsfiddle.net/rUq7M/
这篇关于JQuery UI日期选择器minDate和日期范围看起来很漂亮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文