When "today" is selected in datepicker, the minTime
of timepicker is = current time, and if the select date is not today, the minTime
of timepicker is = "12:00am"
. But the minTime
value (below) is never being triggered (I guess) when I tried to select different date. The console.log()
shows the if statement is working fine thou.
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);
Have you tried opening your browser console, selection is not a valid usage, replace your if else section with below code
if (t_milliseconds == ds_milliseconds) {
$(this).datepicker('option', 'minTime', minTime);
console.log ("minTime");
} else {
$(this).datepicker('option', 'minTime', "12:00am");
console.log("12:00am");
}