pawiromitchel
1/27/2017 - 11:24 AM

JS - Calculate the difference between 2 dates

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))