# Working Days Calculator: Business Days & Public Holidays (`wooden_scanner_c1n/business-day-deadline-calculator`) Actor

Working days calculator: add or count business days and working hours for 200+ countries and their regions, public holidays, Gulf Friday/Saturday weekends, Islamic holidays with Hijri dates, and TARGET2 / stock-exchange calendars. Combine calendars for cross-border deadlines. Pure computation.

- **URL**: https://apify.com/wooden_scanner_c1n/business-day-deadline-calculator.md
- **Developed by:** [Sean](https://apify.com/wooden_scanner_c1n) (community)
- **Categories:** Developer tools, AI, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 calculations

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-Day & Deadline Calculator: Gulf weekends, Hijri holidays, TARGET2

Work out deadlines that respect real-world calendars:

- **Add or subtract N business days.** Example: "10 business days from 16 March in the UAE".
- **Count business days between two dates.**
- **Find the next or previous business day,** or check whether a date is one.
- **Add N calendar days, then roll to a business day.** Supports following, modified following, preceding and modified preceding, for contracts and settlement.
- **Add N working hours** inside a 09:00–17:00 (or custom) workday. Use this for SLAs and support tickets.
- **List the holidays** in a date range.

It covers **200+ countries and their regions** (Bavaria, New York, Scotland, Quebec and more). It also covers the **Gulf weekends**: Friday/Saturday in Saudi Arabia, Qatar, Kuwait, Bahrain and Oman, and Saturday/Sunday in the UAE. **Islamic holidays** come with an *estimated* flag and a moon-sighting caveat, and every result also gets a **Hijri date** (Umm al-Qura). Financial calendars are included too: **TARGET2 (ECB)**, NYSE, LSE, Tadawul and others.

**Combine calendars for cross-border work.** For example, `["XECB", "AE"]` counts a day only if it is a business day in both the euro settlement system and the UAE.

It is pure computation with no scraping and no external API calls, so a run finishes in seconds.

### Who it is for

- **AI agents and LLM tools** that need correct deadline maths instead of guessing. Call it through the Apify API or the Apify MCP server (`mcp.apify.com`) as a tool.
- **Finance and treasury teams:** T+N settlement, payment value dates, end-of-month roll conventions.
- **Logistics and e-commerce:** delivery promise dates across the Middle East and Europe.
- **Legal and HR operations:** notice periods, response deadlines, SLA clocks.

### Input example

```json
{
  "calculations": [
    {"label": "UAE invoice due", "operation": "add_business_days", "calendars": ["AE"], "startDate": "2026-03-16", "days": 10},
    {"label": "Riyadh office reopens", "operation": "next_business_day", "calendars": ["SA"], "startDate": "2026-03-18"},
    {"label": "Munich working days in Dec", "operation": "count_business_days", "calendars": ["DE-BY"], "startDate": "2026-11-30", "endDate": "2026-12-31"},
    {"label": "EUR/AED T+2", "operation": "add_business_days", "calendars": ["XECB", "AE"], "startDate": "2026-12-24", "days": 2},
    {"label": "Coupon date", "operation": "add_calendar_days", "calendars": ["GB-ENG"], "startDate": "2026-01-01", "days": 30, "rollConvention": "modified_following"},
    {"label": "Support SLA (16 working hours)", "operation": "add_business_hours", "calendars": ["IE"], "startDateTime": "2026-12-24T15:00", "hours": 16, "workdayStart": "09:00", "workdayEnd": "17:30"}
  ],
  "extraHolidays": ["2026-12-31"]
}
```

If you leave a field out of a calculation (calendars, weekendDays, extraHolidays, extraWorkingDays, workdayStart, workdayEnd, rollConvention), it is taken from the top level. If `calculations` is empty, the single-calculation form fields are used. If those are empty too, the built-in examples run.

**Conventions:**

- `count_business_days` counts the business days after `startDate`, up to and including `endDate`. That way `add_business_days(start, count) == end`.
- `days: 0` returns the start date if it is a business day, or else the next business day.
- Working-hours times are local wall-clock times. No time-zone conversion is applied.

### Output example (one record per calculation)

```json
{
  "label": "UAE invoice due",
  "operation": "add_business_days",
  "calendars": ["AE"],
  "weekendDays": ["Saturday", "Sunday"],
  "startDate": "2026-03-16",
  "businessDays": 10,
  "resultDate": "2026-04-01",
  "resultWeekday": "Wednesday",
  "resultHijriDate": "1447-10-13",
  "resultIsBusinessDay": true,
  "nonBusinessDaysSkipped": 6,
  "holidaysSkipped": 4,
  "weekendDaysSkipped": 2,
  "skippedDays": [
    {"date": "2026-03-19", "weekday": "Thursday", "reason": "holiday", "holidays": [{"name": "Eid al-Fitr Holiday", "calendar": "AE", "estimated": false}]}
  ],
  "containsEstimatedHolidays": false,
  "caveat": "Some Islamic holidays here are estimates. Their exact dates depend on official moon-sighting announcements ...",
  "source": "Computed offline from the open-source python-holidays library ...",
  "licence": "Holiday rules: python-holidays, MIT licence ..."
}
```

Inputs that cannot be used come back as a record with an `error` field and are **not charged**.

### Calendar codes

- **Countries:** ISO 3166 alpha-2 codes, e.g. `AE`, `SA`, `QA`, `KW`, `BH`, `OM`, `EG`, `JO`, `TR`, `IE`, `GB`, `US`, `DE`, `FR`, `IN`, `PK`, `MY`, `ID`.
- **Regions:** `COUNTRY-REGION`, e.g. `DE-BY`, `US-NY`, `GB-SCT`, `CA-QC`, `ES-CT`, `AU-NSW`.
- **Markets:** `XECB` (alias `TARGET2`), `XNYS`, `XNAS`, `XLON`, `XSAU` (Tadawul), `XETR`, `XHKG`, `XJPX`, `XBOM`, `XNSE`, `XTSE`, `XSES` and more.

### Pricing (pay per event)

- **$0.005 per run start.**
- **$0.001 per successful calculation.** 1,000 deadlines cost $1.
- Rejected inputs are free. Platform compute is minimal, because a run is under 10 seconds at 512 MB.

### Data source and licence

- Holiday rules come from the open-source [python-holidays](https://github.com/vacanza/holidays) library (MIT licence, © Vacanza Team and contributors). It is maintained from official government sources.
- Hijri dates come from [hijridate](https://github.com/dralshehri/hijridate) (MIT licence), which is based on the official Umm al-Qura calendar.
- The library version is printed in every record's `source` field.
- No personal data is processed.

### Limits and honest caveats

- **Islamic holidays:**
  - Dates marked `estimated: true` are astronomical estimates. Gulf governments confirm Eid dates only days ahead, after moon sighting, and sometimes add bridge days.
  - Re-run close to the date, or add announced days with `extraHolidays`.
  - Hijri conversion covers 1924–2077.
- **What counts as a holiday:** only public holidays as modelled by the library. That excludes company shutdowns, half-days (such as UAE Friday afternoons for some sectors) and some "substitute day" practices. Use `extraHolidays` or `extraWorkingDays` to adjust.
- **Supported range:** dates from 1950 to 2099. Scans are capped at about 10 years, and `list_holidays` at about 5 years per calculation.
- Results are informational, not legal or financial advice. Check statutory deadlines against the official source.

# Actor input Schema

## `calculations` (type: `array`):

A JSON array, one object per calculation. Each object has an 'operation' (add_business_days, subtract_business_days, count_business_days, next_business_day, previous_business_day, is_business_day, add_calendar_days, add_business_hours, list_holidays), 'calendars' (e.g. \["AE"], \["DE-BY"], \["XECB", "SA"]) and the dates it needs: 'startDate', 'endDate', 'days', 'startDateTime', 'hours', 'rollConvention'. Optional 'label' is echoed back. Any field left out is taken from the shared settings below. Leave the whole list empty to use the single-calculation fields below, or to run the built-in examples.

## `operation` (type: `string`):

Used when 'Calculations' is empty and a start date is given.

## `startDate` (type: `string`):

YYYY-MM-DD.

## `endDate` (type: `string`):

YYYY-MM-DD. For count_business_days and list_holidays.

## `days` (type: `integer`):

Business days (or calendar days for add_calendar_days). Negative goes backwards.

## `startDateTime` (type: `string`):

Local wall-clock time for add_business_hours, e.g. 2026-12-24T15:00.

## `hours` (type: `integer`):

For add_business_hours (decimals such as 2.5 are accepted in the batch JSON).

## `calendars` (type: `array`):

ISO country codes (AE, SA, QA, KW, BH, OM, EG, IE, GB, US...), country-subdivision (DE-BY, US-NY, GB-SCT, CA-QC) or market calendars (XECB or TARGET2, XNYS, XLON, XSAU...). With several calendars a day counts only if it is a business day in all of them.

## `weekendDays` (type: `array`):

Replace the calendars' own weekend, e.g. \["Friday"] for a six-day week. Leave empty to use each country's official weekend.

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

Company shutdowns or newly announced bridge days, YYYY-MM-DD.

## `extraWorkingDays` (type: `array`):

Dates that count as business days even if they are a weekend or holiday, YYYY-MM-DD.

## `workdayStart` (type: `string`):

For add_business_hours, HH:MM.

## `workdayEnd` (type: `string`):

For add_business_hours, HH:MM (up to 23:59).

## `rollConvention` (type: `string`):

For add_calendar_days: what to do when the date lands on a non-business day.

## `maxCalculations` (type: `integer`):

Safety cap. You pay per successful calculation; rejected inputs are free.

## Actor input object example

```json
{
  "calculations": [
    {
      "label": "UAE: 10 business days from 16 Mar 2026",
      "operation": "add_business_days",
      "calendars": [
        "AE"
      ],
      "startDate": "2026-03-16",
      "days": 10
    },
    {
      "label": "Saudi Arabia: next business day",
      "operation": "next_business_day",
      "calendars": [
        "SA"
      ],
      "startDate": "2026-03-18"
    },
    {
      "label": "Bavaria: business days in December",
      "operation": "count_business_days",
      "calendars": [
        "DE-BY"
      ],
      "startDate": "2026-11-30",
      "endDate": "2026-12-31"
    },
    {
      "label": "TARGET2 + UAE: T+2",
      "operation": "add_business_days",
      "calendars": [
        "XECB",
        "AE"
      ],
      "startDate": "2026-12-24",
      "days": 2
    }
  ],
  "operation": "add_business_days",
  "calendars": [
    "AE"
  ],
  "workdayStart": "09:00",
  "workdayEnd": "17:00",
  "rollConvention": "following",
  "maxCalculations": 1000
}
```

# Actor output Schema

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

All calculation records from the run.

# 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 = {
    "calculations": [
        {
            "label": "UAE: 10 business days from 16 Mar 2026",
            "operation": "add_business_days",
            "calendars": [
                "AE"
            ],
            "startDate": "2026-03-16",
            "days": 10
        },
        {
            "label": "Saudi Arabia: next business day",
            "operation": "next_business_day",
            "calendars": [
                "SA"
            ],
            "startDate": "2026-03-18"
        },
        {
            "label": "Bavaria: business days in December",
            "operation": "count_business_days",
            "calendars": [
                "DE-BY"
            ],
            "startDate": "2026-11-30",
            "endDate": "2026-12-31"
        },
        {
            "label": "TARGET2 + UAE: T+2",
            "operation": "add_business_days",
            "calendars": [
                "XECB",
                "AE"
            ],
            "startDate": "2026-12-24",
            "days": 2
        }
    ],
    "calendars": [
        "AE"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("wooden_scanner_c1n/business-day-deadline-calculator").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 = {
    "calculations": [
        {
            "label": "UAE: 10 business days from 16 Mar 2026",
            "operation": "add_business_days",
            "calendars": ["AE"],
            "startDate": "2026-03-16",
            "days": 10,
        },
        {
            "label": "Saudi Arabia: next business day",
            "operation": "next_business_day",
            "calendars": ["SA"],
            "startDate": "2026-03-18",
        },
        {
            "label": "Bavaria: business days in December",
            "operation": "count_business_days",
            "calendars": ["DE-BY"],
            "startDate": "2026-11-30",
            "endDate": "2026-12-31",
        },
        {
            "label": "TARGET2 + UAE: T+2",
            "operation": "add_business_days",
            "calendars": [
                "XECB",
                "AE",
            ],
            "startDate": "2026-12-24",
            "days": 2,
        },
    ],
    "calendars": ["AE"],
}

# Run the Actor and wait for it to finish
run = client.actor("wooden_scanner_c1n/business-day-deadline-calculator").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 '{
  "calculations": [
    {
      "label": "UAE: 10 business days from 16 Mar 2026",
      "operation": "add_business_days",
      "calendars": [
        "AE"
      ],
      "startDate": "2026-03-16",
      "days": 10
    },
    {
      "label": "Saudi Arabia: next business day",
      "operation": "next_business_day",
      "calendars": [
        "SA"
      ],
      "startDate": "2026-03-18"
    },
    {
      "label": "Bavaria: business days in December",
      "operation": "count_business_days",
      "calendars": [
        "DE-BY"
      ],
      "startDate": "2026-11-30",
      "endDate": "2026-12-31"
    },
    {
      "label": "TARGET2 + UAE: T+2",
      "operation": "add_business_days",
      "calendars": [
        "XECB",
        "AE"
      ],
      "startDate": "2026-12-24",
      "days": 2
    }
  ],
  "calendars": [
    "AE"
  ]
}' |
apify call wooden_scanner_c1n/business-day-deadline-calculator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,wooden_scanner_c1n/business-day-deadline-calculator"
        }
    }
}
```

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/fdazQGegdMATUVa5r/builds/gK1J4F42RQAmKUBEv/openapi.json
