jQuery datepicker mindat,maxdate [英] jQuery datepicker mindate, maxdate
问题描述
我有两个以下的datepicker对象,但我不能得到我想要的,因为我遇到了minDate和maxDate选项:
:将日期从当前日期限制为30年时间。
我获得:将日期从当前日期限制为10年。
$(。datepickerFuture)。datepicker({
showOn:button,
buttonImage :'calendar.gif',
buttonText:'点击选择日期',
duration:fast,
changeMonth:true,
changeYear:true,
dateFormat:'dd / mm / yy',
constrainInput:true,
minDate:0,
maxDate:'+ 30Y',
buttonImageOnly:true
} );
这是为了限制只选择过去日期:
我想要的:将日期从当前日期限制为120年前的时间。
strong>我获得:将日期从当前日期限制到120年前的时间,但是当我选择年份时,最大年份将重置为所选年份(例如,当新页面加载为1890- 2010,但如果我选择2000年选择框重置为1880-2000)。
$(datepickerPast)。datepicker({
showOn:button,
buttonImage :'calendar.gif',
buttonText:'点击选择日期',
duration:fast,
changeMonth:true,
changeYear:true,
dateFormat:'dd / mm / yy',
constrainInput:true,
yearRange:'-120:0',
maxDate:0,
buttonImageOnly:true
});
我需要帮助datepicker对象,任何帮助将非常赞赏。
我修复了我的问题,这是因为jquery库有点过时。
如果有人对此解决方案感兴趣,请检查此处。
I have the two following datepicker objects but I can't get what I want as I am getting stuck with the minDate and maxDate options:
This is to restrict the dates to future dates.
What I want: restrict the dates from current date to 30 years time.
What I get: restrict the dates from current date to 10 years time.
$(".datepickerFuture").datepicker({
showOn: "button",
buttonImage: 'calendar.gif',
buttonText: 'Click to select a date',
duration:"fast",
changeMonth: true,
changeYear: true,
dateFormat: 'dd/mm/yy',
constrainInput: true,
minDate: 0,
maxDate: '+30Y',
buttonImageOnly: true
});
This is to restrict to select only past dates:
What I want: restrict the dates from current date to 120 years ago time.
What I get: restrict the dates from current date to 120 years ago time, but when I select a year the maximum year will reset to selected year (e.g. what I would get when page load from fresh is 1890-2010, but if I select 2000 the year select box reset to 1880-2000) .
$(".datepickerPast").datepicker({
showOn: "button",
buttonImage: 'calendar.gif',
buttonText: 'Click to select a date',
duration:"fast",
changeMonth: true,
changeYear: true,
dateFormat: 'dd/mm/yy',
constrainInput: true,
yearRange: '-120:0',
maxDate: 0,
buttonImageOnly: true
});
I need help with both datepicker object, any help would be very much appreciated.
I fixed my problem which it was the jquery libraries were a bit out date.
If anyone interested on this solution please check here.
这篇关于jQuery datepicker mindat,maxdate的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!