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
Assuming that input is a valid Javascript Date object, you could perhaps try:
function dateDifference(oldDate) {
var currentDate = new Date();
var difference = currentDate - oldDate; //unit: milliseconds
var numDays = 7;
var threshHoldTime = numDays * (24 * 60 * 60 * 1000); //seven days in milliseconds
if (difference > threshHoldTime ) {
console.log("The difference is greateer then then 7 days");
}
else {
console.log("the date is not enough: " + difference);
}
}