onSelect 事件 datepicker 触发 timepicker 中 minTime 值的变化
onSelect event datepicker triggers change of minTime value in timepicker
当"today"在datepicker中select时,timepicker的minTime
=当前时间,如果select日期不是今天,[= timepicker 的 11=] 是 = "12:00am"
。但是当我尝试 select 不同的日期时,minTime
值(下图)永远不会被触发(我猜)。 console.log()
表明 if 语句工作正常。
var selection = jQuery("input#ezfc_element-15-child.ezfc-element-timepicker").data("settings");
var today = localdate.toLocaleDateString("en-US");
setTimeout(function(){
jQuery( ".ezfc-element-datepicker" ).datepicker({
minDate: new Date(today),
defaultDate: new Date(today),
onSelect: function(dateText) {
var ds_milliseconds = Date.parse(dateText);
var t_milliseconds = Date.parse(today);
if (t_milliseconds == ds_milliseconds) {
selection['minTime'] = minTime;
console.log ("minTime");
} else {
selection['minTime'] = "12:00am" ;
console.log("12:00am");
}
}
});
}, 3000);
您是否尝试过打开浏览器控制台,选择无效,请将您的 if else 部分替换为以下代码
if (t_milliseconds == ds_milliseconds) {
$(this).datepicker('option', 'minTime', minTime);
console.log ("minTime");
} else {
$(this).datepicker('option', 'minTime', "12:00am");
console.log("12:00am");
}
当"today"在datepicker中select时,timepicker的minTime
=当前时间,如果select日期不是今天,[= timepicker 的 11=] 是 = "12:00am"
。但是当我尝试 select 不同的日期时,minTime
值(下图)永远不会被触发(我猜)。 console.log()
表明 if 语句工作正常。
var selection = jQuery("input#ezfc_element-15-child.ezfc-element-timepicker").data("settings");
var today = localdate.toLocaleDateString("en-US");
setTimeout(function(){
jQuery( ".ezfc-element-datepicker" ).datepicker({
minDate: new Date(today),
defaultDate: new Date(today),
onSelect: function(dateText) {
var ds_milliseconds = Date.parse(dateText);
var t_milliseconds = Date.parse(today);
if (t_milliseconds == ds_milliseconds) {
selection['minTime'] = minTime;
console.log ("minTime");
} else {
selection['minTime'] = "12:00am" ;
console.log("12:00am");
}
}
});
}, 3000);
您是否尝试过打开浏览器控制台,选择无效,请将您的 if else 部分替换为以下代码
if (t_milliseconds == ds_milliseconds) {
$(this).datepicker('option', 'minTime', minTime);
console.log ("minTime");
} else {
$(this).datepicker('option', 'minTime', "12:00am");
console.log("12:00am");
}