// Save a date. You can pass any date as first parameter to the constructor,
// or just use today's date if you don't pass anything, like below
const savedDate = new Date();
// Create function which checks if date parameter is bigger than saved date
const isFuture = date => new Date(date.toDateString()) > savedDate;
// Get the date from an input field
const dateInput = new Date(document.querySelector('#dateField').value);
if (!isFuture(dateInput)) {
// Date input is before or on the saved date
alert('Date must be in the future!');
}
else {
// work with future date...
}