# Business Days & Holidays Calculator (`cleaner_86/business-days-holidays`) Actor

Count business days, add/subtract working days, check dates and list public holidays for 200+ countries and their states/regions, with custom weekends and company holidays. Batch, fast, no scraping.

- **URL**: https://apify.com/cleaner_86/business-days-holidays.md
- **Developed by:** [Arman](https://apify.com/cleaner_86) (community)
- **Categories:** Developer tools, Automation, Business
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.40 / 1,000 calculation requests

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Business Days & Holidays Calculator

Count business days, add or subtract working days, check whether a date is a business day, and list public holidays. It covers **251 countries and territories and 628 states/regions** (US states, UK nations, German Länder, Canadian provinces, Australian states and more). Send thousands of calculations in one run.

It uses the open-source [`holidays`](https://github.com/vacanza/holidays) dataset. Observed substitute days are handled, e.g. Friday when July 4 falls on a Saturday. No scraping and no external API calls, so it's fast and deterministic.

### Operations

| `operation` | Fields | Returns |
|---|---|---|
| `business_days_between` | `startDate`, `endDate` (+ `includeStartDate`, `includeEndDate`) | `businessDays`, `calendarDays`, `weekendDays`, `holidaysOnWorkdays`, `holidays` |
| `add_business_days` | `date`, `days` (negative to subtract) | `resultDate`, `resultWeekday`, `holidaysSkipped` |
| `is_business_day` | `date` | `isBusinessDay`, `reason` |
| `list_holidays` | `year` | `count`, `holidayList` |
| `next_business_day` / `previous_business_day` | `date` (+ `inclusive`) | `resultDate` |

Options apply to all requests and can be overridden in each request:

- `country`, which is an ISO 3166-1 alpha-2 code
- `subdivision`, e.g. `NY`, `CA`, `ENG`, `SCT`, `BY`
- `weekend`, e.g. `["FRI","SAT"]`
- `extraHolidays` for company shutdown days
- `observedHolidays`

### Example input

```json
{
  "country": "US",
  "requests": [
    {"operation": "business_days_between", "startDate": "2026-11-01", "endDate": "2026-11-30"},
    {"operation": "add_business_days", "date": "2026-12-23", "days": 3},
    {"operation": "is_business_day", "date": "2026-07-03"},
    {"operation": "next_business_day", "date": "2026-12-24", "country": "GB", "subdivision": "ENG"},
    {"operation": "list_holidays", "year": 2026, "subdivision": "NY"}
  ]
}
```

### Example output

```json
{"operation": "add_business_days", "country": "US", "resultDate": "2026-12-29", "resultWeekday": "Tuesday",
 "holidaysSkipped": [{"date": "2026-12-25", "reason": "holiday: Christmas Day"}], "error": null}
```

You get one dataset item per request. An invalid request returns an `error` message instead of failing the whole run, and errored requests are free.

### Safety circuit breaker

To avoid wasting your compute on a broken batch, a run stops early after **5 consecutive errored requests** or when **more than 50% of the last 20 requests** fail. Remaining requests are skipped and **not charged**, and the last dataset row (`operation: "circuit_breaker"`, `status: "paused"`) explains why. Fix the inputs and run again. Unexpected internal errors (`errorType: "internal"`) also pause new runs in your account for 10 minutes (`retryAfter`). After that, the next run is a trial: it resets the breaker if it succeeds and pauses again if it fails. Input mistakes never cause that cooldown. You can tune or disable the breaker with the advanced `circuitBreaker` input field.

### Conventions

- `business_days_between` counts both ends by default, like Excel `NETWORKDAYS`. The result is negative if `endDate` is before `startDate`.
- `add_business_days` doesn't count the start date, like Excel `WORKDAY`. `days: 0` returns the date unchanged.

### Pricing

**$0.40 per 1,000 requests**: you pay per successful result row, with no monthly subscription. Requests that return an `error` are not charged.

### Limitations

- Public and bank holidays only. Ad-hoc closures, such as government-declared extra days, appear only after the holiday dataset is updated.
- Religious holidays based on lunar calendars are calculated and can differ by a day from local announcements.
- Stock-exchange and financial-market calendars are not included.

# Actor input Schema

## `requests` (type: `array`):

List of calculation requests. Each object needs 'operation' (business_days_between | add_business_days | is_business_day | list_holidays | next_business_day | previous_business_day) plus its fields: startDate/endDate (YYYY-MM-DD), date, days (integer, negative subtracts), year, inclusive (next/previous: allow the given date itself). Any default below (country, subdivision, weekend, ...) can be overridden per request.

## `country` (type: `string`):

ISO 3166-1 alpha-2 code (US, GB, DE, FR, CA, AU, JP, IN, ...).

## `subdivision` (type: `string`):

Optional state/region code, e.g. NY, CA, TX for US; ENG, SCT, WLS, NIR for GB; BY for DE.

## `weekend` (type: `array`):

Non-working weekdays as MON..SUN (or 0..6, 0=Monday). Default SAT, SUN.

## `extraHolidays` (type: `array`):

Company-specific non-working dates, as "YYYY-MM-DD" strings or {"date":"YYYY-MM-DD","name":"..."}.

## `includeStartDate` (type: `boolean`):

Count the start date if it is a business day.

## `includeEndDate` (type: `boolean`):

Count the end date if it is a business day.

## `observedHolidays` (type: `boolean`):

Treat 'observed' substitute days (e.g. Friday when July 4 falls on Saturday) as holidays.

## `circuitBreaker` (type: `object`):

Optional overrides: maxConsecutiveErrors (default 5), windowSize (20), errorRate (0.5 = stop if more than 50% of the last windowSize requests failed), minWindow (20), cooldownSeconds (600, internal errors only), enabled (true). The run stops early and skipped requests are not charged.

## Actor input object example

```json
{
  "requests": [
    {
      "operation": "business_days_between",
      "startDate": "2026-11-01",
      "endDate": "2026-11-30"
    },
    {
      "operation": "add_business_days",
      "date": "2026-12-23",
      "days": 3
    },
    {
      "operation": "is_business_day",
      "date": "2026-07-03"
    },
    {
      "operation": "next_business_day",
      "date": "2026-12-24",
      "country": "GB",
      "subdivision": "ENG"
    },
    {
      "operation": "list_holidays",
      "year": 2026,
      "subdivision": "NY"
    }
  ],
  "country": "US",
  "weekend": [
    "SAT",
    "SUN"
  ],
  "extraHolidays": [],
  "includeStartDate": true,
  "includeEndDate": true,
  "observedHolidays": true,
  "circuitBreaker": {
    "maxConsecutiveErrors": 5,
    "windowSize": 20,
    "errorRate": 0.5
  }
}
```

# Actor output Schema

## `results` (type: `string`):

All results (overview view)

## `ranges` (type: `string`):

No description

## `dates` (type: `string`):

No description

## `holidays` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "requests": [
        {
            "operation": "business_days_between",
            "startDate": "2026-11-01",
            "endDate": "2026-11-30"
        },
        {
            "operation": "add_business_days",
            "date": "2026-12-23",
            "days": 3
        },
        {
            "operation": "is_business_day",
            "date": "2026-07-03"
        },
        {
            "operation": "next_business_day",
            "date": "2026-12-24",
            "country": "GB",
            "subdivision": "ENG"
        },
        {
            "operation": "list_holidays",
            "year": 2026,
            "subdivision": "NY"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("cleaner_86/business-days-holidays").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "requests": [
        {
            "operation": "business_days_between",
            "startDate": "2026-11-01",
            "endDate": "2026-11-30",
        },
        {
            "operation": "add_business_days",
            "date": "2026-12-23",
            "days": 3,
        },
        {
            "operation": "is_business_day",
            "date": "2026-07-03",
        },
        {
            "operation": "next_business_day",
            "date": "2026-12-24",
            "country": "GB",
            "subdivision": "ENG",
        },
        {
            "operation": "list_holidays",
            "year": 2026,
            "subdivision": "NY",
        },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("cleaner_86/business-days-holidays").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "requests": [
    {
      "operation": "business_days_between",
      "startDate": "2026-11-01",
      "endDate": "2026-11-30"
    },
    {
      "operation": "add_business_days",
      "date": "2026-12-23",
      "days": 3
    },
    {
      "operation": "is_business_day",
      "date": "2026-07-03"
    },
    {
      "operation": "next_business_day",
      "date": "2026-12-24",
      "country": "GB",
      "subdivision": "ENG"
    },
    {
      "operation": "list_holidays",
      "year": 2026,
      "subdivision": "NY"
    }
  ]
}' |
apify call cleaner_86/business-days-holidays --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,cleaner_86/business-days-holidays"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/IUWwRb0Isu6AkPjbA/builds/kVBovajf0vMgmiIJo/openapi.json
