To add N
days to a Date you use Date.getDate() + N
var d1 = new Date('10/01/2019');
var d2 = new Date('10/04/2019');
var isGreater = +d2 > d1.setDate(d1.getDate() + 3); // false (equals three days)
Given the above you can make a simple reusable function
/**
* Check if d2 is greater than d1
* @param {String|Object} d1 Datestring or Date object
* @param {String|Object} d2 Datestring or Date object
* @param {Number} days Optional number of days to add to d1
*/
function isDateGreater (d1, d2, days) {
d1 = new Date(d1);
return +new Date(d2) > d1.setDate(d1.getDate() + (days||0))
}
console.log(isDateGreater('10/01/2019', '10/03/2019', 3)); // false (smaller)
console.log(isDateGreater('10/01/2019', '10/04/2019', 3)); // false (equal)
console.log(isDateGreater('10/01/2019', '10/05/2019', 3)); // true (greater than)
// Without the optional third parameter
console.log(isDateGreater('10/01/2019', '10/05/2019')); // true (is greater date)
To recap: make a function that, after adding N
days to a date, evaluates two timestamps.
Date.setDate MDN
Date.getDate MDN