简而言之,我有一张表格,并且有选择日期和注册时间, 因此,如果我选择今天的日期,则需要取消当前时间的过去所有小时
我的代码在这里:
$(function() {
$("#returnDate").datepicker({
changeMonth: true,
numberOfMonths: 2,
showAnim: 'blind',
dateFormat: 'yy-mm-dd',
onSelect: function(selectedDate) {
$("#returnTime").timepicker({
'scrollDefault': 'now'
});
setTimeout(function() {
$("#returnTime").timepicker('show');
$("#pickDate").datepicker("option", "maxDate", selectedDate);
}, 16);
}
});
});
<div class="col-xs-12 col-md-6">
<div class="row">
<div class="col-xs-12 col-sm-6 col-md-8 inside-margin-right form-group">
<div class="input-group reservation__hire-date">
<input type="text" id="pickDate" class="form-control " placeholder="تاريخ الإستلام" name="pickDate">
<span class="input-group-text"><span class="fa fa-calendar"></span></span>
</div>
</div>
<div class="input-group saatwidth">
<input type="text" id="pickTime" class="form-control " placeholder="الساعة" name="pickTime">
<span class="input-group-text"><span class="fa fa-clock"></span></span>
</div>
</div>
</div>