DateTimePicker引导错误添加天数

时间:2016-01-25 12:02:57

标签: twitter-bootstrap datetimepicker

我有一个来自bootstrap的datetimepicker,我想禁用某些天,并在两天内开始日期。代码是:

expect(imageElement.getAttribute('src')).toBe("imgSrc");

当我添加两天时,datetimepicker会添加几天,并且我只想添加启用的日期。

我该怎么办?

罗伯特

1 个答案:

答案 0 :(得分:1)

试试这个

<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],
  });
});

Demo On Fiddle