deterministic
no-api-key
time
calendar
business-days

Business days calculator: add or count working days with your weekend mask and holiday list

Business days calculator with a caller-supplied calendar: add or subtract N working days from a date, or count the working days between two dates. The weekend is a weekday mask (Friday-Saturday and Sunday-only weeks work) and holidays are an explicit date list, so nothing depends on a stale holiday table. Returns the result date, the day count and the skipped dates with reasons. The skipped list is capped at 1,000 entries (skipped_truncated flags it); skipped_total is always exact.

Output (data): add: result (YYYY-MM-DD), from, days, calendar_days_spanned, skipped [{date, reason weekend|holiday, weekday}] (first 1,000), skipped_total, skipped_truncated. count: business_days, calendar_days, weekend_days, holiday_days, holidays_matched, direction (forward|backward) (holidays on a weekend are reported as weekend, never as holiday). count is half-open [from, to) unless inclusive says otherwise; when to precedes from the same interval is counted backwards and business_days is still a non-negative count. skipped is in the order the dates were traversed and lists at most 1,000 entries; skipped_total is the full count and skipped_truncated is true when the list was cut (the cap only binds for days beyond roughly 1,400 working-day skips, e.g. days near 3,650 with a two-day weekend); result, calendar_days_spanned and skipped_total are always exact.

Deterministic: identical input returns identical output, so the response is served with Cache-Control: private, max-age=31536000, immutable (the paying client may cache it indefinitely; shared caches must not, because the response is paid).

Price: $0.05 USDC per call (x402, Base). Route contract version 1.0.0. Docs: https://api.duoleads.com/docs#time-business-days

get/v1/time/business-days

Request

  • Base URL: https://api.duoleads.com
  • URL: https://api.duoleads.com/v1/time/business-days
  • Auth: none declared

Query parameters

op'add' | 'count'

add (default) N business days to from, or count business days between from and to. Accepted: add, count.

fromstring date required

Start date, YYYY-MM-DD. Accepted: a calendar date as YYYY-MM-DD.

daysinteger

Business days to add, -3650 to 3650. Required when op=add. Accepted: integer between -3650 and 3650.

tostring date

End date YYYY-MM-DD, may precede from. Required when op=count. Accepted: a calendar date as YYYY-MM-DD.

weekendstring

Comma-separated weekday names or ISO numbers. Default sat,sun. Empty string = no weekend. Accepted: comma-separated weekday names (mon..sun) or ISO numbers 1-7.

holidaysstring

Comma-separated YYYY-MM-DD holiday dates. Accepted: comma-separated YYYY-MM-DD dates, at most 2048 characters.

inclusive'start' | 'both' | 'neither'

For op=count: start (default, half-open [from, to)), both or neither. Accepted: start, both, neither.

Response

Paid and settled. data is route-specific; a route that judges its input returns 200 with data.valid: false for a bad value.

okunknown required
route'/v1/time/business-days' required
version'1.0.0' required

Changes

No recorded changes to this operation across all 1 revision of this API.