php - bootstrap date picker blocking dates -
i have used date picker bootstrap. wondering how exclude 10 days selected day user has clicked
for example user chooses 10th april 2015. user can select dates 10th april 2015 - 19th april 2015 ending date.
here code date picker.
<script type="text/javascript"> var nowdate = new date(); var today = new date(nowdate.getfullyear(), nowdate.getmonth(), nowdate.getdate(), 0, 0, 0, 0); $(function () { $('#startdate').datetimepicker({ mindate:today, format: 'yyyy-mm-dd hh:mm:ss' }).change(function (selected) { var startdate = new date(selected.date.valueof()); $('#enddate').datetimepicker('maxdate', startdate+10); }); $('#enddate').datetimepicker({ mindate:today, format: 'yyyy-mm-dd hh:mm:ss' }); }); </script>
option "enableddates", disables selection of dates not in array, perhaps work you?
http://eonasdan.github.io/bootstrap-datetimepicker/options/#enableddates