JS - Calculate the difference between 2 dates
function daysBetween(one, another) { return Math.round(Math.abs(one - another) / 8.64e7); } // usage a = daysBetween(new Date(date1), new Date(date2))