# SettleDate: Business Days & Settlement Dates (`pearlescent_cupola/settledate-business-days`) Actor

Business-day, holiday and T+N settlement-date arithmetic for nine jurisdictions (US, CA, UK, DE, FR, NL, IE, AU, NZ), from published statutory rules. Observed/substitute days are handled; calendars that cannot be computed are refused, not guessed.

- **URL**: https://apify.com/pearlescent_cupola/settledate-business-days.md
- **Developed by:** [宇轩 段](https://apify.com/pearlescent_cupola) (community)
- **Categories:** Business
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## 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

## SettleDate: Business Days & Settlement Dates

Calculate business days, holidays, and **T+N settlement-date** arithmetic across nine jurisdictions using published statutory rules. The Actor requires no upstream API, no key, and no network calls. The same input always returns the same dates.

Bank clearing, invoice due dates, SaaS billing, SLA deadlines: being one day off costs more than missing a data field. Skipping only Saturdays and Sundays fails on statutory holidays. For example, **2026-07-03 is a Friday, but it is the observed U.S. Independence Day** (July 4 is a Saturday). A T+2 settlement from 2026-07-02 is **2026-07-07**, not 2026-07-06.

### What it computes

The rule engine supports three modes:

| Mode | Input | Output (one record each) |
|---|---|---|
| `settle` (default) | `dates[]` + `convention` (`T+0` … `T+5`, `next`, `prev`) | `start_date` → `settlement_date`, `business_days_added`, `weekday`, `calendar_complete` |
| `holidays` | `year`, or `from`/`to` | One record per holiday: `date`, `name`, `type` (`statutory`/`substitute`), `falls_on` |
| `business_days` | `from`/`to` | One summary record: `business_days` count plus the `days[]` list |

Supported calendars: `US`, `CA`, `UK` (England & Wales), `DE`, `FR`, `NL`, `IE`, `AU` (national), `NZ` (national).

#### Why the output is reliable

1. **Observed and substitute days:** Saturday shifts to Friday, Sunday shifts to Monday, and the engine applies the "next free weekday" rules used in the UK, New Zealand, and Australia.
2. **Bank holidays are excluded**, not just weekends.
3. **Explicit gaps:** Every record returns `calendar_complete` and, where relevant, `known_gaps`. Calendars with dates set by annual government decree or the lunar calendar (CN, SG, HK, JP, IN, BR) return an explicit error instead of an unverified date.

### Examples

Settlement:

```json
{ "mode": "settle", "calendar": "US", "dates": ["2026-07-02", "2026-12-24"], "convention": "T+2" }
```

```json
{
  "kind": "settlement",
  "calendar": "US",
  "convention": "T+2",
  "start_date": "2026-07-02",
  "settlement_date": "2026-07-07",
  "business_days_added": 2,
  "weekday": "Tuesday",
  "calendar_complete": true
}
```

Holidays:

```json
{ "mode": "holidays", "calendar": "UK", "year": 2026 }
```

Business days in range:

```json
{ "mode": "business_days", "calendar": "DE", "from": "2026-10-01", "to": "2026-12-31" }
```

The full input schema is in `input_schema.json`. Each field includes a title and description, so an agent can build a call without reading this page.

### Output notes

| Field | Meaning |
|---|---|
| `kind` | Record type: `settlement`, `holiday`, or `business_days` |
| `calendar` | ISO code of the selected calendar |
| `convention` | Requested T+N rule (e.g., `T+2`, `next`, `prev`) |
| `start_date` / `settlement_date` | Input start date and calculated settlement date |
| `business_days_added` | Business days added (skips weekends and holidays) |
| `calendar_complete` | Returns `false` if the jurisdiction has known unmodeled days |
| `known_gaps` | Plain-text list of unmodeled dates (e.g., Scottish holidays, state-level AU days) |
| `type` | Holiday category: `statutory` or `substitute` (observed) |

### Errors

The Actor returns a JSON error instead of guessing dates:

| Situation | Result |
|---|---|
| Unsupported calendar (CN/SG/HK/JP/IN/BR, or a typo) | Error; no records, no charge |
| `settle` mode without `dates` | Error; no records |
| Malformed date, unknown convention, > 500 dates | Error; no records |
| Range with no business days | 0 records; no charge |

### Billing

Billing is **per run** (one charge per request), not per record: 100 dates cost the same as one date. The billing event is `settlement-run` (one charge per completed run). The current price is listed on this Actor's page, and runs that return no records are free.

### Limitations — read before buying

- Supports nine jurisdictions only. The engine rejects unsupported jurisdictions instead of estimating dates.
- Sub-national coverage is limited: `AU` covers national holidays only (no state holidays); `CA` covers federal holidays, not every province; `UK` covers England & Wales only (no Scottish or Northern Irish holidays). The engine reports these limits through `calendar_complete` / `known_gaps` instead of silently dropping dates.
- New Zealand's Matariki is set by annual legislation and is not modeled; NZ records explicitly state this.
- Rules reflect published statutory calendars as of the build date. Unscheduled holiday changes by government decree fall outside the model; check `calendar_complete` for the calendar you rely on.
- Does not constitute investment, legal, tax, or accounting advice. For settlement instructions that move money, verify against your bank's official calendar.

### Privacy

This Actor processes only the input you provide (dates, calendar codes, mode). It makes no external network calls, stores no personal data, and requires no API key.

# Actor input Schema

## `mode` (type: `string`):

settle: resolve a T+N settlement date per input date. holidays: list the holidays in a window. business_days: count business days in a window.

## `calendar` (type: `string`):

US, CA, UK (England & Wales), DE, FR, NL, IE, AU (national), NZ (national). CN/SG/HK/JP/IN/BR are not supported on purpose: their holidays are set by yearly decree or the lunar calendar, and a guessed date is worse than no date.

## `dates` (type: `array`):

ISO dates (YYYY-MM-DD), one settlement date is reported per entry. Max 500.

## `convention` (type: `string`):

Business days counted after the start date. T+0 returns the date unchanged; next/prev is one business day.

## `year` (type: `integer`):

Return every holiday of this year. Ignored when from/to are given.

## `from` (type: `string`):

ISO date, inclusive. Used when year is empty.

## `to` (type: `string`):

ISO date, inclusive. A range may not exceed 800 days.

## Actor input object example

```json
{
  "mode": "settle",
  "calendar": "US",
  "dates": [
    "2026-07-02",
    "2026-12-24"
  ],
  "convention": "T+2"
}
```

# Actor output Schema

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

Computed records, one dataset item each.

# 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 = {
    "dates": [
        "2026-07-02",
        "2026-12-24"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("pearlescent_cupola/settledate-business-days").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 = { "dates": [
        "2026-07-02",
        "2026-12-24",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("pearlescent_cupola/settledate-business-days").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 '{
  "dates": [
    "2026-07-02",
    "2026-12-24"
  ]
}' |
apify call pearlescent_cupola/settledate-business-days --silent --output-dataset

```

## MCP server setup

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

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/n4vJ3NyhQh6KRlLU9/builds/kwDMnGGCe3C0DYvz1/openapi.json
