The following function takes in two dates and returns the number of days between them: // Calculate the difference of two dates in total days function diffDays(d1, d2) { let numDays = 0; let tv1 = d1.getTime(); // msec since 1970 let tv2 = d2.getTime(); numDays = (tv2 – tv1) / 1000 / 86400; numDays … Continue reading JavaScript: How to calculate the number of days between two dates