JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="http://www.eyecon.ro/bootstrap-datepicker/css/bootstrap.css">
<link rel="stylesheet" href="http://www.eyecon.ro/bootstrap-datepicker/css/datepicker.css">
<script src="http://www.eyecon.ro/bootstrap-datepicker/js/jquery.js"></script>
<script src="http://www.eyecon.ro/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
<input type="text" class="span2" value="09-28-2012" id="dp1" >
CSS
.container {
background: #fff;
}
#alert {
display: none;
}
JavaScript
var startDate = new Date();
startDate.setDate(startDate .getDate()-15);
var endDate = new Date();
$('#dp1')
.datepicker().on('changeDate', function(ev){
console.log(ev.date.valueOf())
console.log(endDate.valueOf())
console.log(startDate.valueOf())
if (ev.date.valueOf() > endDate.valueOf()){
alert('The date selected is too far in the future.');
} else if (ev.date.valueOf() < startDate.valueOf()){
alert('The date selected is too far in the past');
} else {
alert('fine')
}
});