Check if date is in the past Javascript
$(‘#datepicker’).datepicker().change(evt => { var selectedDate = $(‘#datepicker’).datepicker(‘getDate’); var now = new Date(); now.setHours(0,0,0,0); if (selectedDate < now) { console.log(“Selected date is in the past”); } else { console.log(“Selected date is NOT in the past”); } }); <script src=”https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js”></script> <script src=”https://code.jquery.com/ui/1.12.1/jquery-ui.min.js”></script> <input type=”text” id=”datepicker” name=”event_date” class=”datepicker”>