JSFiddle - React, Tailwind, and code Playground
by mukkaram waheed
HTML
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css">
<link rel="stylesheet" href="https://uxsolutions.github.io/bootstrap-datepicker/bootstrap-datepicker/css/bootstrap-datepicker3.min.css">
<script src="https://uxsolutions.github.io/bootstrap-datepicker/bootstrap-datepicker/js/bootstrap-datepicker.min.js"></script>
<input id="doctortime" class="form-control" placeholder="Doctor Date" name="dates" data-date-format="mm/dd/yyyy" />
JavaScript
var onlyThisDates = ["09/20/2018", "09/26/2018", "09/29/2018", "09/27/2018", "09/20/2018", "09/21/2018", "09/22/2018", "10/01/2018", "10/03/2018", "10/05/2018", "10/11/2018", "10/15/2018", "10/17/2018"];
console.log(onlyThisDates);
$('#doctortime').datepicker({
format: "mm/dd/yyyy",
autoclose: true,
beforeShowDay: function (date) {
var MyDateString = ('0' + date.getDate()).slice(-2);
var dt_ddmmyyyy =(date.getMonth() + 1) + '/' + MyDateString + '/' + date.getFullYear();
console.log(MyDateString);
return (onlyThisDates.indexOf(dt_ddmmyyyy) != -1);
}
});