Calendar
Public holidays and business days for hundreds of countries, plus Easter, ISO weeks, and RRULE recurrences
- Connector software
- Free and open source
- Service credentials
- Not needed
- Query Farm hosting
- Available Β· $10/month organization minimum
Use with an agent
Install the Orchard skill in your project to help your agent find connectors, configure them, and verify SQL results.
npx skills add Query-farm/vgi-skills --skill orchard
Copy this request into your coding agent to get started.
Use https://query.farm/products/orchard/connectors/calendar/index.md to help me query Calendar with DuckDB or Haybarn 2.0.1 and VGI protocol 3.4. Ask only for missing details about the result I need or whether I want local execution, self-hosting or Query Farm hosting. Check the connector's actual hosting availability, credentials and input requirements. Read one format of each needed reference and the exact object declarations before writing SQL. Use a released connector, and distinguish a saved example result from anything you actually execute. If you cannot run the query, tell me what remains to verify.
weekly-recurrence
Example output Β· captured
- Connector release
- v0.6.0
- Engine
- 2.0.1
- VGI protocol
- 3.4.0
SELECT seq, occurrence
FROM cal.main.rrule(TIMESTAMP '2026-01-01', 'FREQ=WEEKLY;COUNT=4')
ORDER BY seq;
| seq | occurrence |
|---|---|
| 0 | 2026-01-01 00:00 |
| 1 | 2026-01-08 00:00 |
| 2 | 2026-01-15 00:00 |
| 3 | 2026-01-22 00:00 |
Quick start
Choose where to run Calendar, then follow the steps below.
The connector runs alongside DuckDB or Haybarn. No Query Farm account is needed.
1. Install the vgi extension
Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
INSTALL vgi FROM community;
LOAD vgi;
2. Attach the connector
Attach with uvx
Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.
ATTACH 'cal' AS cal (
TYPE vgi,
LOCATION 'uvx --from git+https://github.com/Query-farm/[email protected] vgi-calendar-worker'
);
Attach the signed image
Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.
ATTACH 'cal' AS cal (
TYPE vgi,
LOCATION 'oci://ghcr.io/query-farm/vgi-calendar:0.6.0'
);
3. Run a query
SELECT seq, occurrence
FROM cal.main.rrule(TIMESTAMP '2026-01-01', 'FREQ=WEEKLY;COUNT=4')
ORDER BY seq;
Run the connector on a server you manage. You operate the service and choose who can connect.
1. Deploy the connector on your server
Follow the connectorβs deployment instructions. Use its supported HTTP transport, or launch it remotely over SSH. The connection guide explains both options.
2. Install the vgi extension
Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
INSTALL vgi FROM community;
LOAD vgi;
3. Attach the connector
For an HTTP deployment, replace the example URL with your endpoint. Add the authentication options your deployment requires. For SSH, use the SSH connection instructions.
ATTACH 'cal' AS cal
(TYPE vgi, LOCATION 'https://your-connector.example.com');
4. Run a query
SELECT seq, occurrence
FROM cal.main.rrule(TIMESTAMP '2026-01-01', 'FREQ=WEEKLY;COUNT=4')
ORDER BY seq;
Query Farm operates Calendar for your team. Hosting has a $10 monthly minimum per organization; usage counts toward it. From $2.97 per instance-month ($10 monthly minimum).
1. Create your hosted connector
Open the console, choose your organization and deployment size, and add any service credentials there.
2. Install the vgi extension
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
INSTALL vgi FROM community;
LOAD vgi;
3. Attach your deployment
Copy the ATTACH statement from your deployment in the console and run it in DuckDB or Haybarn. Use cal as the catalog alias for the query below.
4. Run a query
SELECT seq, occurrence
FROM cal.main.rrule(TIMESTAMP '2026-01-01', 'FREQ=WEEKLY;COUNT=4')
ORDER BY seq;
Technical details
- Verified connector release
- v0.6.0
- Engine
- 2.0.1
- VGI protocol
- 3.4.0
- Verified on
- December 1, 2026
Pin a version for production
When running the connector yourself, keep a specific release until youβre ready to upgrade. Replace the ATTACH statement above with this one and follow the same extension and credential setup.
Attach with uvx
Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.
ATTACH 'cal' AS cal (
TYPE vgi,
LOCATION 'uvx --from git+https://github.com/Query-farm/[email protected] vgi-calendar-worker'
);
Attach the signed image
Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.
ATTACH 'cal' AS cal (
TYPE vgi,
LOCATION 'oci://ghcr.io/query-farm/vgi-calendar:0.6.0'
);
Overview
Holiday, business-day, and recurrence calendar math for SQL
cal brings public-holiday lookups, business-day arithmetic, and RFC-5545 (RRULE) recurrence expansion directly into DuckDB SQL β no ETL, no Python glue, just SELECT. Ask whether a date is a holiday or a working day, name the holiday, add or count business days, or expand a recurrence rule into a series of timestamps, all as ordinary SQL expressions and table functions.
This VGI worker is for analysts, data engineers, and application developers who need correct calendar logic close to their data: payment and settlement date math, SLA and business-day deadlines, payroll and billing cycles, and scheduling and reminders. It exposes a single cal catalog (schema main) over Apache Arrow, so every function streams results back to DuckDB with native types β DATE, TIMESTAMP, and TIMESTAMPTZ round-trip cleanly. Coverage is global, not US-centric: hundreds of countries and their subdivisions are supported, and 'US' is merely the default argument, not a limit.
The holiday and business-day engine is powered by the holidays library (docs), which models hundreds of national and subdivision calendars. Recurrence and Easter math come from python-dateutil (docs), whose rrulestr parser implements the RFC-5545 recurrence grammar. For stock-exchange trading calendars (sessions, market hours, and schedules), see the companion vgi-trading-calendar worker.
Per-row questions are answered by scalar functions you can drop straight into a projection or predicate; set-returning questions β a year's holidays, a range of working days, an expanded recurrence β are table functions. Country/subdivision are ordinary arguments that default to 'US'; the supported_countries table enumerates every valid country/subdiv code. Weekend-aware is_business_day differs from holiday-only is_holiday; recurrence rules must be bounded (COUNT/UNTIL) or they never terminate.
Catalog
Everything cal exposes once attached β read straight from the worker's
released build.
main 1 table Β· 11 functions
Holiday, business-day, and recurrence functions plus the supported-countries table
Schema examples (18)
Is Christmas 2026 a US public holiday?
SELECT cal.main.is_holiday(DATE '2026-12-25') AS is_holiday;
Name of the US holiday on 4 July 2026.
SELECT cal.main.holiday_name(DATE '2026-07-04') AS holiday_name;
Is Christmas 2026 a US business day?
SELECT cal.main.is_business_day(DATE '2026-12-25') AS is_business_day;
Two US business days after 24 December 2026 (skips Christmas + weekend).
SELECT cal.main.add_business_days(DATE '2026-12-24', 2) AS due;
14 more examples
How many US business days fall in January 2026.
SELECT cal.main.business_days_between(DATE '2026-01-01', DATE '2026-02-01') AS n;
Western Easter Sunday in 2026.
SELECT cal.main.easter(2026) AS easter_sunday;
ISO-8601 year-week label for 22 June 2026.
SELECT cal.main.iso_year_week(DATE '2026-06-22') AS iso_year_week;
US + California public holidays in 2026, projected and ordered.
SELECT date, name
FROM cal.main.holidays(2026, country := 'US', subdiv := 'CA')
ORDER BY date;
The first four weekly occurrences from 1 January 2026.
SELECT seq, occurrence
FROM cal.main.rrule(TIMESTAMP '2026-01-01', 'FREQ=WEEKLY;COUNT=4')
ORDER BY seq;
| seq | occurrence |
|---|---|
| 0 | 2026-01-01 00:00 |
| 1 | 2026-01-08 00:00 |
| 2 | 2026-01-15 00:00 |
| 3 | 2026-01-22 00:00 |
US business days in the 2026 year-end week, in order.
SELECT date
FROM cal.main.business_days(DATE '2026-12-21', DATE '2026-12-31', country := 'US')
ORDER BY date;
How many distinct countries the holiday functions support.
SELECT count(DISTINCT country) AS countries
FROM cal.main.supported_countries;
Payment calendar: 1st-of-month 2026 payments from rrule, rolled forward to the next US business day when the 1st is not one, with the reason: the holiday name, or the weekday for weekend rolls.
WITH sched AS (SELECT r.seq, CAST(r.occurrence AS DATE) AS due FROM cal.main.rrule(TIMESTAMP '2026-01-01', 'FREQ=MONTHLY;BYMONTHDAY=1;COUNT=12') AS r) SELECT due, CASE WHEN cal.main.is_business_day(due) THEN due ELSE cal.main.add_business_days(due, 1) END AS settles_on, CASE WHEN NOT cal.main.is_business_day(due) THEN coalesce(cal.main.holiday_name(due), dayname(due)) END AS rolled_because
FROM sched
ORDER BY seq;
Capacity plan: US business days per month in 2026, with the holidays that fell on a weekday and so removed a working day (weekend holidays such as Saturday 4 July are left out).
WITH bd AS (SELECT date_trunc('month', date) AS month, count(*) AS business_days FROM cal.main.business_days(DATE '2026-01-01', DATE '2026-12-31', country := 'US') GROUP BY ALL), lost AS (SELECT date_trunc('month', date) AS month, count(*) AS weekday_holidays, string_agg(name, ', ' ORDER BY date) AS holiday_names FROM cal.main.holidays(2026, country := 'US') WHERE isodow(date) <= 5 GROUP BY ALL) SELECT strftime(bd.month, '%Y-%m') AS month, bd.business_days, coalesce(lost.weekday_holidays, 0) AS weekday_holidays, lost.holiday_names
FROM bd
LEFT JOIN lost USING (month)
ORDER BY bd.month;
Cross-border settlement window: the days from 21 Dec 2026 to 8 Jan 2027 when both the US and the UK (GB) are open, i.e. US business days that are also GB business days.
SELECT b.date, dayname(b.date) AS weekday
FROM cal.main.business_days(DATE '2026-12-21', DATE '2027-01-08', country := 'US') AS b
WHERE cal.main.is_business_day(b.date, 'GB')
ORDER BY b.date;
Sprint capacity: US business days in each ISO week from 30 Nov 2026 to 10 Jan 2027, labelled with iso_year_week (Christmas and New Year's Day cut W52 and W53 to 4 days).
SELECT cal.main.iso_year_week(b.date) AS iso_week,
count(*) AS business_days, min(b.date) AS first_day,
max(b.date) AS last_day
FROM cal.main.business_days(DATE '2026-11-30', DATE '2027-01-10', country := 'US') AS b
GROUP BY ALL
ORDER BY iso_week;
Countdown: the US holidays on or after 13 November 2026, with how many US business days remain until each (business_days_between counts [start, end)).
SELECT h.date, h.name,
cal.main.business_days_between(DATE '2026-11-13', h.date) AS business_days_away
FROM cal.main.holidays(2026, country := 'US') AS h
WHERE h.date >= DATE '2026-11-13'
ORDER BY h.date;
Moveable feasts: the German holidays whose offset from easter() is the same in 2025, 2026 and 2027, i.e. the Easter-anchored ones, with that offset in days. Fixed-date holidays such as Labor Day drop out.
WITH h AS (SELECT date, name FROM cal.main.holidays(2025, country := 'DE') UNION ALL SELECT date, name FROM cal.main.holidays(2026, country := 'DE') UNION ALL SELECT date, name FROM cal.main.holidays(2027, country := 'DE')) SELECT name, min(date - cal.main.easter(year(date))) AS days_from_easter
FROM h
GROUP BY name
HAVING count(*) = 3 AND count(DISTINCT date - cal.main.easter(year(date))) = 1
ORDER BY days_from_easter;
Cross-border closures: the 2026 dates that are a public holiday in both the US and GB, with each country's holiday name.
SELECT us.date, us.name AS us_holiday, gb.name AS gb_holiday
FROM cal.main.holidays(2026, country := 'US') AS us
JOIN cal.main.holidays(2026, country := 'GB') AS gb ON us.date = gb.date
ORDER BY us.date;
supported_countries
Discovery table of every (country, subdivision) the holiday/business-day functions accept.
How many countries are supported.
SELECT count(DISTINCT country) FROM cal.main.supported_countries;
German subdivisions (BundeslΓ€nder).
SELECT subdivision FROM cal.main.supported_countries WHERE country = 'DE';
add_business_days (date DATE, n INTEGER, country VARCHAR, subdiv VARCHAR) +2 overloads
Advance a date by N business days, skipping weekends + holidays (country 'US')
add_business_days(date DATE, n INTEGER) β DATEadd_business_days(date DATE, n INTEGER, country VARCHAR) β DATEadd_business_days(date DATE, n INTEGER, country VARCHAR, subdiv VARCHAR) β DATE
Two business days after 2026-12-24 (skips Christmas + weekend)
SELECT cal.main.add_business_days(DATE '2026-12-24', 2);
Two UK business days after 2026-12-24
SELECT cal.main.add_business_days(DATE '2026-12-24', 2, 'GB');
Two California business days after 2026-03-30 (skips Cesar Chavez Day)
SELECT cal.main.add_business_days(DATE '2026-03-30', 2, 'US', 'CA');
1 more example
Payment calendar: 1st-of-month 2026 payments from rrule, rolled forward to the next US business day when the 1st is not one, with the reason: the holiday name, or the weekday for weekend rolls.
WITH sched AS (SELECT r.seq, CAST(r.occurrence AS DATE) AS due FROM cal.main.rrule(TIMESTAMP '2026-01-01', 'FREQ=MONTHLY;BYMONTHDAY=1;COUNT=12') AS r) SELECT due, CASE WHEN cal.main.is_business_day(due) THEN due ELSE cal.main.add_business_days(due, 1) END AS settles_on, CASE WHEN NOT cal.main.is_business_day(due) THEN coalesce(cal.main.holiday_name(due), dayname(due)) END AS rolled_because
FROM sched
ORDER BY seq;
business_days_between (start DATE, end DATE, country VARCHAR, subdiv VARCHAR) +2 overloads
Count business days in [start, end) (start inclusive; country defaults to 'US')
business_days_between(start DATE, end DATE) β INTEGERbusiness_days_between(start DATE, end DATE, country VARCHAR) β INTEGERbusiness_days_between(start DATE, end DATE, country VARCHAR, subdiv VARCHAR) β INTEGER
Business days in January 2026
SELECT cal.main.business_days_between(DATE '2026-01-01', DATE '2026-02-01');
UK business days in January 2026
SELECT cal.main.business_days_between(DATE '2026-01-01', DATE '2026-02-01', 'GB');
California business days in March 2026 (excludes Cesar Chavez Day)
SELECT cal.main.business_days_between(DATE '2026-03-01', DATE '2026-04-01', 'US', 'CA');
1 more example
Countdown: the US holidays on or after 13 November 2026, with how many US business days remain until each (business_days_between counts [start, end)).
SELECT h.date, h.name,
cal.main.business_days_between(DATE '2026-11-13', h.date) AS business_days_away
FROM cal.main.holidays(2026, country := 'US') AS h
WHERE h.date >= DATE '2026-11-13'
ORDER BY h.date;
easter (year BIGINT)
Western (Gregorian) Easter Sunday for a year
Easter Sunday in 2026
SELECT cal.main.easter(2026);
Days from that year's Easter Sunday (easter accepts year(d) directly)
SELECT d, d - cal.main.easter(year(d)) AS days_from_easter
FROM (VALUES (DATE '2026-04-03'), (DATE '2027-05-06')) AS t(d)
ORDER BY d;
Moveable feasts: the German holidays whose offset from easter() is the same in 2025, 2026 and 2027, i.e. the Easter-anchored ones, with that offset in days. Fixed-date holidays such as Labor Day drop out.
WITH h AS (SELECT date, name FROM cal.main.holidays(2025, country := 'DE') UNION ALL SELECT date, name FROM cal.main.holidays(2026, country := 'DE') UNION ALL SELECT date, name FROM cal.main.holidays(2027, country := 'DE')) SELECT name, min(date - cal.main.easter(year(date))) AS days_from_easter
FROM h
GROUP BY name
HAVING count(*) = 3 AND count(DISTINCT date - cal.main.easter(year(date))) = 1
ORDER BY days_from_easter;
holiday_name (date DATE, country VARCHAR, subdiv VARCHAR) +2 overloads
Public-holiday name on a date, or NULL (country defaults to 'US')
holiday_name(date DATE) β VARCHARholiday_name(date DATE, country VARCHAR) β VARCHARholiday_name(date DATE, country VARCHAR, subdiv VARCHAR) β VARCHAR
Name of the US holiday on 2026-07-04
SELECT cal.main.holiday_name(DATE '2026-07-04');
Name of the UK holiday on Christmas 2026
SELECT cal.main.holiday_name(DATE '2026-12-25', 'GB');
Name of the California holiday on 2026-03-31
SELECT cal.main.holiday_name(DATE '2026-03-31', 'US', 'CA');
is_business_day (date DATE, country VARCHAR, subdiv VARCHAR) +2 overloads
True if a date is a weekday and not a public holiday (country defaults to 'US')
is_business_day(date DATE) β BOOLEANis_business_day(date DATE, country VARCHAR) β BOOLEANis_business_day(date DATE, country VARCHAR, subdiv VARCHAR) β BOOLEAN
Is Christmas 2026 a business day?
SELECT cal.main.is_business_day(DATE '2026-12-25');
Is Christmas 2026 a UK business day?
SELECT cal.main.is_business_day(DATE '2026-12-25', 'GB');
Is Cesar Chavez Day a California business day?
SELECT cal.main.is_business_day(DATE '2026-03-31', 'US', 'CA');
1 more example
Cross-border settlement window: the days from 21 Dec 2026 to 8 Jan 2027 when both the US and the UK (GB) are open, i.e. US business days that are also GB business days.
SELECT b.date, dayname(b.date) AS weekday
FROM cal.main.business_days(DATE '2026-12-21', DATE '2027-01-08', country := 'US') AS b
WHERE cal.main.is_business_day(b.date, 'GB')
ORDER BY b.date;
is_holiday (date DATE, country VARCHAR, subdiv VARCHAR) +2 overloads
True if a date is a public holiday (country defaults to 'US')
is_holiday(date DATE) β BOOLEANis_holiday(date DATE, country VARCHAR) β BOOLEANis_holiday(date DATE, country VARCHAR, subdiv VARCHAR) β BOOLEAN
Is Christmas 2026 a (US) holiday?
SELECT cal.main.is_holiday(DATE '2026-12-25');
Is Christmas 2026 a UK holiday?
SELECT cal.main.is_holiday(DATE '2026-12-25', 'GB');
Cesar Chavez Day is a California holiday
SELECT cal.main.is_holiday(DATE '2026-03-31', 'US', 'CA');
iso_week (date DATE)
ISO-8601 week number (1..53) for a date
ISO week of a date
SELECT cal.main.iso_week(DATE '2026-06-22');
iso_year_week (date DATE)
ISO-8601 year-week label, e.g. '2026-W26'
ISO year-week label of a date
SELECT cal.main.iso_year_week(DATE '2026-06-22');
Sprint capacity: US business days in each ISO week from 30 Nov 2026 to 10 Jan 2027, labelled with iso_year_week (Christmas and New Year's Day cut W52 and W53 to 4 days).
SELECT cal.main.iso_year_week(b.date) AS iso_week,
count(*) AS business_days, min(b.date) AS first_day,
max(b.date) AS last_day
FROM cal.main.business_days(DATE '2026-11-30', DATE '2027-01-10', country := 'US') AS b
GROUP BY ALL
ORDER BY iso_week;
business_days (start DATE, end DATE, country := VARCHAR, subdiv := VARCHAR)
Every business day in an inclusive [start, end] range
How many US business days fall in the 2026 year-end week (Christmas excluded)
SELECT count(*) AS business_days
FROM cal.main.business_days(DATE '2026-12-21', DATE '2026-12-31', country := 'US');
The US business days of the 2026 year-end week, in order
SELECT date
FROM cal.main.business_days(DATE '2026-12-21', DATE '2026-12-31', country := 'US')
ORDER BY date;
Capacity plan: US business days per month in 2026, with the holidays that fell on a weekday and so removed a working day (weekend holidays such as Saturday 4 July are left out).
WITH bd AS (SELECT date_trunc('month', date) AS month, count(*) AS business_days FROM cal.main.business_days(DATE '2026-01-01', DATE '2026-12-31', country := 'US') GROUP BY ALL), lost AS (SELECT date_trunc('month', date) AS month, count(*) AS weekday_holidays, string_agg(name, ', ' ORDER BY date) AS holiday_names FROM cal.main.holidays(2026, country := 'US') WHERE isodow(date) <= 5 GROUP BY ALL) SELECT strftime(bd.month, '%Y-%m') AS month, bd.business_days, coalesce(lost.weekday_holidays, 0) AS weekday_holidays, lost.holiday_names
FROM bd
LEFT JOIN lost USING (month)
ORDER BY bd.month;
2 more examples
Cross-border settlement window: the days from 21 Dec 2026 to 8 Jan 2027 when both the US and the UK (GB) are open, i.e. US business days that are also GB business days.
SELECT b.date, dayname(b.date) AS weekday
FROM cal.main.business_days(DATE '2026-12-21', DATE '2027-01-08', country := 'US') AS b
WHERE cal.main.is_business_day(b.date, 'GB')
ORDER BY b.date;
Sprint capacity: US business days in each ISO week from 30 Nov 2026 to 10 Jan 2027, labelled with iso_year_week (Christmas and New Year's Day cut W52 and W53 to 4 days).
SELECT cal.main.iso_year_week(b.date) AS iso_week,
count(*) AS business_days, min(b.date) AS first_day,
max(b.date) AS last_day
FROM cal.main.business_days(DATE '2026-11-30', DATE '2027-01-10', country := 'US') AS b
GROUP BY ALL
ORDER BY iso_week;
holidays (year BIGINT, country := VARCHAR, subdiv := VARCHAR)
All public holidays in a year (date, name, observed)
Every US public holiday in 2026, as (date, name) ordered by date
SELECT date, name
FROM cal.main.holidays(2026, country := 'US')
ORDER BY date;
US + California holidays in 2026, ordered by date
SELECT date, name
FROM cal.main.holidays(2026, country := 'US', subdiv := 'CA')
ORDER BY date;
Countdown: the US holidays on or after 13 November 2026, with how many US business days remain until each (business_days_between counts [start, end)).
SELECT h.date, h.name,
cal.main.business_days_between(DATE '2026-11-13', h.date) AS business_days_away
FROM cal.main.holidays(2026, country := 'US') AS h
WHERE h.date >= DATE '2026-11-13'
ORDER BY h.date;
4 more examples
Moveable feasts: the German holidays whose offset from easter() is the same in 2025, 2026 and 2027, i.e. the Easter-anchored ones, with that offset in days. Fixed-date holidays such as Labor Day drop out.
WITH h AS (SELECT date, name FROM cal.main.holidays(2025, country := 'DE') UNION ALL SELECT date, name FROM cal.main.holidays(2026, country := 'DE') UNION ALL SELECT date, name FROM cal.main.holidays(2027, country := 'DE')) SELECT name, min(date - cal.main.easter(year(date))) AS days_from_easter
FROM h
GROUP BY name
HAVING count(*) = 3 AND count(DISTINCT date - cal.main.easter(year(date))) = 1
ORDER BY days_from_easter;
Cross-border closures: the 2026 dates that are a public holiday in both the US and GB, with each country's holiday name.
SELECT us.date, us.name AS us_holiday, gb.name AS gb_holiday
FROM cal.main.holidays(2026, country := 'US') AS us
JOIN cal.main.holidays(2026, country := 'GB') AS gb ON us.date = gb.date
ORDER BY us.date;
SELECT * FROM cal.main.holidays(2026, country := 'US') ORDER BY date;
SELECT count(*) AS n FROM cal.main.holidays(2026, country := 'US');
rrule (dtstart TIMESTAMP, rule VARCHAR, count := INTEGER, until := TIMESTAMP)
Expand an RFC-5545 recurrence rule (dateutil) into timestamps
The first four weekly occurrences from 2026-01-01, indexed and ordered
SELECT seq, occurrence
FROM cal.main.rrule(TIMESTAMP '2026-01-01', 'FREQ=WEEKLY;COUNT=4')
ORDER BY seq;
| seq | occurrence |
|---|---|
| 0 | 2026-01-01 00:00 |
| 1 | 2026-01-08 00:00 |
| 2 | 2026-01-15 00:00 |
| 3 | 2026-01-22 00:00 |
The first of every month in 2026, as (seq, occurrence) ordered by seq
SELECT seq, occurrence
FROM cal.main.rrule(TIMESTAMP '2026-01-01', 'FREQ=MONTHLY;BYMONTHDAY=1', until := TIMESTAMP '2026-12-31')
ORDER BY seq;
Payment calendar: 1st-of-month 2026 payments from rrule, rolled forward to the next US business day when the 1st is not one, with the reason: the holiday name, or the weekday for weekend rolls.
WITH sched AS (SELECT r.seq, CAST(r.occurrence AS DATE) AS due FROM cal.main.rrule(TIMESTAMP '2026-01-01', 'FREQ=MONTHLY;BYMONTHDAY=1;COUNT=12') AS r) SELECT due, CASE WHEN cal.main.is_business_day(due) THEN due ELSE cal.main.add_business_days(due, 1) END AS settles_on, CASE WHEN NOT cal.main.is_business_day(due) THEN coalesce(cal.main.holiday_name(due), dayname(due)) END AS rolled_because
FROM sched
ORDER BY seq;
Try these queries
is-christmas-a-holiday β Whether 25 December 2026 is a US public holiday.
SELECT cal.main.is_holiday(DATE '2026-12-25') AS is_holiday;
Uses is_holiday
add-business-days β Two US business days after 24 December 2026 (skips Christmas + weekend).
SELECT cal.main.add_business_days(DATE '2026-12-24', 2) AS due;
Uses add_business_days
settlement-schedule-following β Payment calendar: 1st-of-month 2026 payments from rrule, rolled forward to the next US business day when the 1st is not one, with the reason: the holiday name, or the weekday for weekend rolls.
WITH sched AS (SELECT r.seq, CAST(r.occurrence AS DATE) AS due FROM cal.main.rrule(TIMESTAMP '2026-01-01', 'FREQ=MONTHLY;BYMONTHDAY=1;COUNT=12') AS r) SELECT due, CASE WHEN cal.main.is_business_day(due) THEN due ELSE cal.main.add_business_days(due, 1) END AS settles_on, CASE WHEN NOT cal.main.is_business_day(due) THEN coalesce(cal.main.holiday_name(due), dayname(due)) END AS rolled_because
FROM sched
ORDER BY seq;
Name of the US holiday on 4 July 2026.
SELECT cal.main.holiday_name(DATE '2026-07-04') AS holiday_name
Uses holiday_name
Is Christmas 2026 a US business day?
SELECT cal.main.is_business_day(DATE '2026-12-25') AS is_business_day
Uses is_business_day
How many US business days fall in January 2026.
SELECT cal.main.business_days_between(DATE '2026-01-01', DATE '2026-02-01') AS n
37 more examples in the Catalog, each listed under the table or function it uses.
Questions it can answer
Plain-English questions from the worker's agent test tasks. An AI agent with this catalog attached should answer each one with SQL.
- Using the cal worker, what is the ISO 8601 year-week label (ISO year and week number) for 1 January 2027? Return the single label string the worker produces.
- Using the cal worker, what is the name of the public holiday in Japan (country code 'JP') on 4 May 2026? Return the single holiday name.
- Using the cal calendar worker, is 4 July 2026 a public holiday in the United States (country code 'US')? Return a single boolean value.
- Using the cal worker, on what calendar date does Western (Gregorian) Easter Sunday fall in 2027? Return a single date.
- Using the cal worker, what is the ISO-8601 week number (a value from 1 to 53) that contains 3 January 2027? Return a single integer.
Calendar is an independent open-source connector from Query.Farm. It is not affiliated with, endorsed by or sponsored by the services, projects or organisations it works with. Product names, logos and trademarks belong to their respective owners.
Related workers
Color
Dates, units & validation
Convert colors between hex, RGB, HSL and CIELAB, measure CIEDE2000 difference, and check WCAG contrast for accessibility
Conform
Dates, units & validation
Check and standardize phone numbers, emails, IBANs, EU VAT numbers, card numbers, URLs and postal codes offline, with no external service
Units
Dates, units & validation
Convert measurements between units, normalize them to SI, and check that two quantities are comparable