METHODOLOGY/ FORMULA
Days Between Dates Methodology
Core formula
days = (endDate - startDate) / 86400000
Dates are compared at midnight local time. The difference in milliseconds is divided by 86,400,000 (the number of milliseconds in one day) and rounded to the nearest integer.
Business days
Business days exclude Saturday (getDay() = 6) and Sunday (getDay() = 0). Public holidays are not included because they vary by country and region.
Leap years
JavaScript Date handles leap years natively. February has 29 days in leap years (divisible by 4, except century years not divisible by 400).