I am trying to compare two different dates to see if the date inputted is after 7 days of todays date. I have done a bit of googling and come up with this:
f
Try like this
var date = new Date(input).getTime(); // Get the milliseconds
var today = new Date();
//You can't compare date,
//so convert them to milliseconds
today = new Date(today.setDate(today.getDate() + 7)).getTime();
if (inputDate < today) {
// The selected time is less than 7 days from now
return false;
} else if{ ()
// -Exact- same timestamps.
return false;
}
else {
// The selected time is more than 7 days from now
return true;
}