0
<div class="col-md-5 no-padding">
<div class="input-group date form_datetime_from col-md-12" id="leavefromdate" data-date="2015-01-01 05:25" data-link-field="leavefrom">
<input class="form-control" type="text" value="" readonly> <span class="input-group-addon success"><span class="glyphicon glyphicon-th"></span></span>
</div>
<input type="hidden" id="leavefrom" name="ApplyLeave[leavefrom]" value="" />
<br/>
</div> <span class="col-md-2 no-padding" style="float:left;line-height:35px;text-align:center">To</span>
<div class="col-md-5 no-padding">
<div class="input-group date form_datetime_to col-md-12" id="leavetodate" data-date="" data-date-format="yyyy-mm-dd H:i" data-link-field="leaveto">
<input class="form-control" type="text" value="" readonly> <span class="input-group-addon success"><span class="glyphicon glyphicon-th"></span></span>
</div>
<input type="hidden" id="leaveto" name="ApplyLeave[leaveto]" value="" />
<br/>
</div>
IM使用此的DateTimePicker http://www.malot.fr/bootstrap-datetimepicker/demo.php首先選擇的DateTimePicker第二dateTimePicker的只選擇日期
我jQuery代碼ID
$(".form_datetime_from").datetimepicker({
format: 'yyyy-mm-dd hh:ii',
autoclose: true,
//linkField: "leaveto",
}).on('changeDate', function (ev) {
$("#leaveto").val($("#leavefrom").val());
$("#leavetodate").attr('data-date', $("#leavefrom").val());
});
//日期選取2
$(".form_datetime_to").datetimepicker({
//setStartDate: '2012-01-01',
format: 'yyyy-mm-dd hh:ii',
autoclose: true,
startDate: "leavefrom",
});
我想設置第二個datetimepicker的最小日期是第一個datetimepicker值。 也用戶只能在第一個的DateTimePicker選擇日期,不能前選擇和後日期