Prevent users from selecting the current date if the current time exceeds a specified hour using JavaScript.
This is what I have attempted:
var d = new Date();
var restricttime = '<?php echo $restrictTime->time_restriction ?>';
var restrictmin = '<?php echo $restrictTime->restrict_min ?>';
var hour = d.getHours();
var minutes_hr = d.getMinutes();
if (restricttime >= hour) {
if (minutes_hr > restrictmin && restricttime >= hour) {
min_Date = 0;
} else {
min_Date = 1;
}
} else {
min_Date = 0;
}
$("#datepicker-13").datepicker({
minDate: min_Date
});
I believe there might be an issue with the logic in this code. Can someone please assist me?