JDay

GET /v1/count-business-days

Count business days between two dates.

Parameters

NameTypeRequiredDescription
startstringYesStart date in YYYY-MM-DD format. This date is excluded from the count.
endstringYesEnd date in YYYY-MM-DD format. This date is included in the count.
countrystringYesISO 3166-1 alpha-2 country code. Case-insensitive.
regionstringNoISO 3166-2 subdivision suffix. Requires paid plan.

Request

curl -X GET "https://jday-api.jday.workers.dev/v1/count-business-days?start=2026-01-01&end=2026-03-31&country=US" \
  -H "Authorization: Bearer jday_live_xxx" \
  -H "Accept: application/json"

Response

{
  "start_date": "2026-01-01",
  "end_date": "2026-03-31",
  "business_days": 62,
  "total_calendar_days": 89,
  "weekends": 26,
  "holidays_on_weekdays": 1,
  "holidays": [
    {
      "date": "2026-01-19",
      "official_date": null,
      "name": "Martin Luther King Jr. Day",
      "local_name": null,
      "type": "public",
      "date_accuracy": "exact"
    }
  ],
  "country": "US",
  "region": null
}

Response Fields

FieldTypeDescription
start_datestringThe supplied start date.
end_datestringThe supplied end date.
business_daysintegerCount of business days. May be negative when start > end.
total_calendar_daysintegerAbsolute count of calendar days traversed.
weekendsintegerAbsolute count of weekend dates traversed.
holidays_on_weekdaysintegerCount of distinct traversed dates with holidays that are not weekends.
holidaysarrayAll holiday records on those weekday-holiday dates. Sorted by date, then name.
countrystringNormalized country code.
regionstring | nullRegion code if provided, otherwise null.

Counting Rule

  • Start date excluded, end date included.
  • Same start and end → all counts are zero, holidays is empty.
  • Reverse order (start > end) → business_days is negative; absolute counts stay non-negative.

Reverse-Order Example

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

Holiday Inclusion Rule

  • holidays_on_weekdays counts distinct dates with at least one holiday that are not weekends.
  • holidays contains all records on those dates.
  • Holidays on weekend dates are excluded — those dates are counted under weekends.

Error Cases

ConditionError
Missing start, end, or country400 missing_parameter
Malformed start or end400 invalid_date
Date outside range400 date_out_of_range
Unknown country400 invalid_country
Invalid region400 invalid_region
Region on Free plan403 plan_upgrade_required

On this page