JDay

Counting Rules

How JDay counts business days — start date exclusion, end date inclusion, and edge cases.

JDay uses deterministic counting rules across all computation endpoints.

Business Day Definition

A business day is any date that is:

  • Not a weekend for the target country on that date
  • Not a national or regional holiday that is a non-working day on that date

Half-days are out of scope for v1.

add-business-days

Core Rule

  • The start date is never counted.
  • Computation moves one calendar day at a time in the sign direction of days.
  • A traversed date counts toward the target only if it is a business day.
  • Weekends and holidays are skipped but tracked in the response metadata.

days Parameter

ValueBehavior
days > 0Move forward
days < 0Move backward
days = 0Return the original input date unchanged

When days = 0:

  • holidays_skipped: []
  • weekends_skipped: 0
  • calendar_days_elapsed: 0

Signed Fields

  • business_days_added echoes the signed input.
  • calendar_days_elapsed is signed: positive forward, negative backward, zero for days = 0.
  • weekends_skipped is always a non-negative absolute count.
  • holidays_skipped is always sorted chronologically (earlier to later), regardless of traversal direction.

Overlap Rule

When a holiday falls on a weekend:

  • The weekend date increments weekends_skipped
  • holidays_skipped includes only holiday records whose effective date is a traversed non-weekend date
  • If multiple holiday records share the same traversed non-weekend date, all appear in holidays_skipped

count-business-days

Core Rule

  • The start date is excluded.
  • The end date is included.
  • If start equals end, all counts are zero and holidays is empty.
  • If start > end, business_days is negative.

Absolute vs Signed Fields

  • business_days may be negative (for reverse-order queries).
  • total_calendar_days, weekends, and holidays_on_weekdays are always non-negative absolute counts.
  • holidays is always sorted chronologically from earlier to later, then by name.

Holiday Inclusion Rule

  • holidays_on_weekdays counts distinct traversed dates that have at least one holiday record and are not weekend dates.
  • holidays contains all holiday records on those weekday-holiday dates.
  • Holidays falling on weekends are excluded from both holidays_on_weekdays and holidays because those dates are classified under weekends.

Reverse-Order Example

start=2026-01-10&end=2026-01-07 traverses dates 2026-01-09, 2026-01-08, and 2026-01-07. It excludes 2026-01-10 (start) and includes 2026-01-07 (end).

On this page