I want to show a timelist dropdown for interval of 30 minutes and based on the date. If the date is today and past the time then the past time will be disabled. If the date is not today then it will show all the timelist.
let $select = jQuery("#s_time");
for (let hr = 8; hr < 22; hr++) {
let hrStr = hr.toString().padStart(2, "0") + ":";
let val = hrStr + "00";
$select.append('<option val="' + val + '">' + val + '</option>');
val = hrStr + "30";
$select.append('<option val="' + val + '">' + val + '</option>')
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div>
<select name="s_time" id="s_time" class="form-control bmg-hrs-mins-input">
</select>
</div>
I expect the time that has been past will be disabled if the date is today and if it is not today then it will show all the timelist.