0

Is there is a way to restrict a selection in Bootstrap DateRange when a user select a disabled day or disabled date

I have setup an example here: https://jsfiddle.net/x6ncnhLv/1/

HTML:

<div class="input-daterange input-group" id="datepicker">
  <input type="text" class="input-sm form-control" name="start" />
  <span class="input-group-addon">to</span>
  <input type="text" class="input-sm form-control" name="end" />
</div>

Javascript:

$('.input-daterange').datepicker({
  daysOfWeekDisabled: "0,6",
  datesDisabled: ['01/06/2016', '01/21/2016']
});

For example if a user select Friday to Monday the selection should not get applied because Sat and Sun are disabled days.

The same applies to dates as well.

VincenzoC
  • 30,117
  • 12
  • 90
  • 112
  • It seems that there is no solution for the above. What i mange to do for those interested is to create a new php file where i pass the dates from the datepicker and verify their correctness. I load the content of this file via Ajax so you can see visually and live the output. With this way a user can check if the date range that he selected are within the rules. – user2833894 Jan 09 '16 at 11:45
  • Check the answer to this question : http://stackoverflow.com/questions/23738226/how-to-prevent-selecting-date-range-in-which-there-is-a-disabled-date-in-between – stark Jan 25 '16 at 20:47

0 Answers0