JSFiddle - React, Tailwind, and code Playground
by Joe
HTML
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<script
src="https://code.jquery.com/jquery-3.4.1.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<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>
<div class="form-group col-4 rfdate">
<label class="col-sm-5 control-label p-sm-0" for="vouchdt">Date</label>
<div class="input-group vcdate datepic" id="vocdate">
<input type="text" class="form-control" id="vochDate" name="vouchdt" th:field="*{strvouchdt}" />
<span class="input-group-addon">
<i class="glyphicon glyphicon-calendar"></i>
</span>
</div>
</div>
<!-- modal -->
<!-- future date warning modal popup -->
<div id="fut_date" class="modal fade" role="dialog" data-backdrop="static">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type=" button" class="close cash-dismiss" data-dismiss="modal">×</button>
<h4 class="modal-title" style="position: relative; right: 78%;">Warning!!</h4>
</div>
<div class="modal-body" for="dateModal">
<p class="dateModal">Some text in the modal.</p>
</div>
<div class="modal-footer">
<button...
JavaScript
$(document).ready(function() {
$("#vochDate").datepicker({
dateFormat: "dd/mm/yy"
}).datepicker("setDate", new Date());
});
$(document).ready(function() {
$("#vochDate").datepicker().on("change", function(e) {
var today = new Date();
var date = (today.getMonth() + 1) + "/" + (today.getDate()) + "/" + (today.getFullYear());
$('#fut_date').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.");
}
});
});