0
votes

i have a datetimepicker from bootstrap and i want to disable some days and start the date in two days. The code is:

 $('#datetimepicker').datepicker
 ({
    daysOfWeekDisabled: '06',
    startDate: '+2d'
  });

When I add two days, the datetimepicker add days off, and I want to add only the days enabled.

How can i do?

Roberto

1

1 Answers

1
votes

Try this

<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