Inclusive vs. exclusive date counting (worked examples)
The single most common off-by-one mistake when counting days between dates is forgetting whether the end date should be included. Both conventions are valid depending on what you are measuring:
| Scenario | Example range | Toggle | Result |
|---|---|---|---|
| Hotel stay (nights) | 2026-07-10 โ 2026-07-14 | Exclusive (default) | 4 nights |
| Paid leave / vacation | 2026-07-13 (Mon) โ 2026-07-17 (Fri) | Inclusive (+1 day) | 5 days |
| Visa entry to exit | 2026-06-01 โ 2026-06-30 | Inclusive (+1 day) | 30 days |
| DST spring-forward week | 2026-03-07 โ 2026-03-14 | Exclusive | 7 days (exact) |
How our integer-day calendar engine avoids DST bugs
Every input date is read strictly as a YYYY-MM-DD string and converted directly to an integer day count using Howard Hinnant’s civil calendar algorithm. Because no JavaScript Date arithmetic or timezone conversion is involved, a 23-hour spring-forward day or 25-hour fall-back day in New York, London, Auckland, or Chatham Islands always yields the exact integer difference.
Leap years handled accurately
2000and2024are leap years (February has 29 days).1900and2100are century years not divisible by 400, so they are not leap years (February has 28 days).