I'm using Eonasdan Bootstrap Datetimepicker: http://eonasdan.github.io/bootstrap-datetimepicker/
Although I can't get the minDate and maxDate to work as expected. Since the date is dynamic and changes the fiddle is set upp with moments.js“ subtract/add
Conditions
minDate = today + 1 day
maxDate = today + 3 days
default value = today + 2 days
The above returns the value tomorrow and not the default value. If minDate is changed to -2 days it works just fine.
See Fiddle: http://jsfiddle.net/9uqpu88v/8/
twoDaysFromToday = moment().add(2, 'd').format('YYYY-MM-DD');
$('#datetimepicker1 input').val(twoDaysFromToday);
var datetimepicker = $('#datetimepicker1').datetimepicker({
format: 'YYYY-MM-DD',
minDate: moment().add(1, 'd').format('YYYY-MM-DD'), // Tomorrow
maxDate: moment().add(3, 'd').format('YYYY-MM-DD'), // Three days from today
})
<div class="form-group">
<div class="input-group date" id="datetimepicker1">
<input type="text" id="datetimepicker1" class="form-control" value="" />
<span class="input-group-addon"><span class="glyphicon-calendar glyphicon"></span></span>
</div>
</div>
moment()doing? - JonathanminDateandmaxDateare set to the given "hardcoded" value), while your snippet is missing required libraries. Anyway I suggest to use moment parsing function specifying format (see docs). In your example:moment('2016-07-01, 'YYYY-MM-DD')instead ofmoment('2016-07-01'). - VincenzoC