DateTimePicker Bootstrap 添加天数时出错
DateTimePicker Bootstrap Error Adding Days
我有一个来自 bootstrap 的日期时间选择器,我想禁用一些日期并在两天后开始日期。代码是:
$('#datetimepicker').datepicker
({
daysOfWeekDisabled: '06',
startDate: '+2d'
});
当我添加两天时,日期时间选择器会添加休息日,而我只想添加启用的日子。
我该怎么办?
罗伯托
试试这个
<br/>
<div class="row">
<div class="col-md-12">
<h6>Datetimepicker</h6>
<div class="form-group">
<div class="input-group date" id="datetimepicker">
<input type="text" class="form-control" /> <span class="input-group-addon"><span class="glyphicon-calendar glyphicon"></span></span>
</div>
</div>
</div>
JavaScript
$(function() {
var date = new Date();
var currentMonth = date.getMonth();
var currentDate = date.getDate();
var currentYear = date.getFullYear();
$('#datetimepicker').datetimepicker({
minDate: new Date(currentYear, currentMonth, currentDate + 2),
daysOfWeekDisabled: [0, 6],
});
});
我有一个来自 bootstrap 的日期时间选择器,我想禁用一些日期并在两天后开始日期。代码是:
$('#datetimepicker').datepicker
({
daysOfWeekDisabled: '06',
startDate: '+2d'
});
当我添加两天时,日期时间选择器会添加休息日,而我只想添加启用的日子。
我该怎么办?
罗伯托
试试这个
<br/>
<div class="row">
<div class="col-md-12">
<h6>Datetimepicker</h6>
<div class="form-group">
<div class="input-group date" id="datetimepicker">
<input type="text" class="form-control" /> <span class="input-group-addon"><span class="glyphicon-calendar glyphicon"></span></span>
</div>
</div>
</div>
JavaScript
$(function() {
var date = new Date();
var currentMonth = date.getMonth();
var currentDate = date.getDate();
var currentYear = date.getFullYear();
$('#datetimepicker').datetimepicker({
minDate: new Date(currentYear, currentMonth, currentDate + 2),
daysOfWeekDisabled: [0, 6],
});
});