Here is code:
<input type="text" class="datepicker" id="flight_start" placeholder="mm-dd-yyyy" data-date-format="mm-dd-yyyy">
...
<script src="/ui/js/jquery.js"></script>
<script src="/ui/js/bootstrap.js"></script>
<script src="/ui/js/datatables/jquery.dataTables.min.js"></script>
<script src="/ui/js/datatables/DT_bootstrap.js"></script>
<script src="/ui/js/responsive-tables/responsive-tables.js"></script>
<script src="/ui/js/datepicker/date.js"></script>
<script src="/ui/js/datepicker/daterangepicker.js"></script>
<script src="/ui/js/chosen/chosen.jquery.js"></script>
<script src="/ui/js/bootstrap-wizard/bootstrap-wizard.js"></script>
<script src="/ui/js/sparkline/jquery.sparkline.min.js"></script>
<script src="/ui/js/datepicker/bootstrap-datepicker.js"</script>
...
<script type="text/javascript">
$('#flight_start').datepicker({
format: "mm-dd-yyyy",
startDate: "+1d"
});
</script>
The format works, but not the start date. I get no errors/warnings, simply does not work. Dates prior to the start date are not grayed out in any way and can be selected. I want to remove this ability. Thanks!
Edit: I've also tried
$('#flight_start').datepicker('setStartDate', '+1d');
Which gives me
Uncaught TypeError: Object [object Object] has no method 'setStartDate'
Looks like the problem was I had an out of date version of bootstrap-datepicker.js.
A coworker just picked up the plugin so I'm not sure why he downloaded an out of date version, oh well.
Try this code, worked for me. disabled dates prior to today
$("YOURSELECTOR").datepicker({
format: 'dd/mm/yyyy',
startDate:new Date()
});
Remember this is bootstrap picker
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With