JSFiddle - React, Tailwind, and code Playground
by chiragvidani
HTML
<input type="button" id="btnValidate" value="Validate" />
JavaScript
$(document).ready(function () {
var exceeds = 0;
$('#btnValidate').click(function () {
var inputDate = new Date(2015, 1, 25);
var today = new Date();
var thresholdDate = new Date();
thresholdDate.setDate(today.getDate() + 2);
thresholdDate.setHours(0,0,0);
alert('Input date: ' + inputDate);
alert('Threshold date: ' + thresholdDate);
if (thresholdDate <= inputDate) {
exceeds++;
alert(exceeds);
}
else
alert('Valid date');
});
});