gpt4 book ai didi

jquery-ui - Jquery UI 日期选择器 日期范围 6 个月 限制

转载 作者:行者123 更新时间:2023-12-04 18:20:33 28 4
gpt4 key购买 nike

我正在使用 jQuery ui 日期选择器(日期范围)我想将其限制为 6 个月

var dates = $("#availability_date_from, #availability_date_to").datepicker({
defaultDate: "+1w",
changeMonth: true,
numberOfMonths: 1,
minDate:'0',

yearRange:'c-18:c',

onSelect: function( selectedDate ) {

var option = this.id == "availability_date_from" ? "minDate" : "maxDate",

instance = $( this ).data( "datepicker" ),

date = $.datepicker.parseDate(
instance.settings.dateFormat ||
$.datepicker._defaults.dateFormat,
selectedDate, instance.settings );
dates.not( this ).datepicker( "option", option, date );


if(this.id == "availability_date_to"){

commonJSComplete(this.value,'availability_date_to');
$('#responsecontainer').load('profilemeter.php');
}
else if(this.id == "availability_date_from"){
commonJSComplete(this.value,'availability_date_from');
}

}

});

最佳答案

试试:


var dates = $("#availability_date_from, #availability_date_to").datepicker({
defaultDate: "+1w",
changeMonth: true,
numberOfMonths: 1,
minDate:'0',
maxDate: '+6m', //add this
.....

关于jquery-ui - Jquery UI 日期选择器 日期范围 6 个月 限制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10311178/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com