JSFiddle - React, Tailwind, and code Playground
by Joe
HTML
<!Doctype>
<html>
<head>
<script src="https://code.jquery.com/jquery-3.4.1.js"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/datepicker/0.6.5/datepicker.css" />
<!-- date picker -->
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.css">
<script type="text/javascript" src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
</head>
<body>
<div class="container">
<input type="text" id="datepicker">
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body">
<p>Some text in the modal.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
JavaScript
/* $(document).ready(function(e) {
$("#datepicker").datepicker().on("change", function(e) {
var today = new Date();
var date = (today.getMonth() + 1) + "/" + (today.getDate()) + "/" + (today.getFullYear());
$('#myModal').modal('show');
if ($(this).val() == date) {
$(".modal-body p").html("You have selected today");
} else if ($(this).val() < date) {
$(".modal-body p").html("You have selected past date");
} else {
$(".modal-body p").html("You have selected future date");
}
});
}); */
$(document).ready(function() {
$("#datepicker").datepicker().on("change", function(e) {
var today = new Date();
var date = (today.getDate()) + "/" + (today.getMonth()) + "/" + (today.getFullYear());
$('#myModal').modal('show');
if ($(this).val() == date) {
$(".modal-body p").html('You are selected todays date');
} else if ($(this).val() < date) {
$(".modal-body p").html("You are entering a past date.");
} else {
($(this).val() > date);
$(".modal-body p").html("You are entering a future date.");
}
});
});