function TDate() {
var UserDate = document.getElementById("userdate").value;
var ToDate = new Date();
if (new Date(UserDate).getTime() <= ToDate.getTime()) {
alert("The Date must be Bigger or Equal to today date");
return false;
}
return true;
}
function isDateInFuture(date) {
return date > Date.now()
}
console.log(isDateInFuture(new Date("2025-01-01")) //true
console.log(isDateInFuture(new Date("2000-03-11")) //false
// make use of date-fns
const date1 = endOfDay(dateToCompare) // passed date with time 00:00
const date2 = endOfDay(new Date()) // get current Date with time 00:00
if (isAfter(date1, date2)) {
console.log(`The passed Date: ${date1} lies in the future`
}