# Holiday Calendars

Canonical page: https://www.adaptabletools.com/docs/dev-guide-tutorial-holiday-calendars

- AdapTable lets developers configure holidays and weekend days for working-day logic
- These feed Column Filters / Expressions such as `IS_WORKDAY`, `IS_HOLIDAY`, `WORKDAY` and `NETWORKDAYS`
- Holidays can be provided as a list of dates (or ISO strings) or via a function

## Working days, weekends and holidays

AdapTable treats these as three distinct ideas:

| Concept | Meaning |
| --- | --- |
| **Weekend** | Days listed in `calendarOptions.weekendDays` (default Saturday & Sunday) |
| **Holiday** | Days listed in `calendarOptions.holidays` (public / bank holidays you supply) |
| **Working day** | Any day that is neither a weekend nor a holiday |

A weekend is **not** a holiday unless you also list it in `holidays`.
Use `IS_WORKDAY` / `NOT IS_WORKDAY` when you care about non-working days in general.

- AdapTable has no built-in public-holiday calendar (even for New Year's Day)
- Developers must supply holidays relevant to each user or market

Date display formatting is unrelated — use [Format Column](https://www.adaptabletools.com/docs/handbook-column-formatting/index.md) (or AG Grid value formatters).

## Providing holidays

Holidays are set via the `holidays` property in [`Calendar Options`](https://www.adaptabletools.com/docs/reference/calendaroptions.md).

### `holidays`

Configured public holidays (calendar days)

List of holidays used when evaluating working-day Expression Functions and Datepicker workday buttons.

The property accepts:

- a list of `Date`s or ISO date strings (`yyyy-MM-dd`)
- a function which returns that list

### Providing a list of holidays

```ts {4,5}
// Set Christmas and New Year as public holidays
const adaptableOptions: AdaptableOptions = {
  calendarOptions: {
    holidays: ['2026-12-25', '2027-01-01'],
  },
}   
```

### Providing a function

The function receives [`BaseContext`](https://www.adaptabletools.com/docs/reference/basecontext.md) and returns a list of dates (useful for per-user calendars):

```ts {3,4,5}
const adaptableOptions: AdaptableOptions = {
  calendarOptions: {
    holidays: (baseContext: BaseContext) => {
      return [new Date(2026, 11, 25), new Date(2027, 0, 1)]
    },
  },
}   
```

## Custom weekend days

Weekend days are set via the `weekendDays` property in [`Calendar Options`](https://www.adaptabletools.com/docs/reference/calendaroptions.md).

### `weekendDays`

Days of the week treated as weekend (non-working)

Days listed here are non-working, using JavaScript `Date.getDay()` values: `0` = Sunday … `6` = Saturday.

The default is Saturday and Sunday. A weekend is not a holiday unless it is also listed in `holidays`.

```ts {3}
const adaptableOptions: AdaptableOptions = {
  calendarOptions: {
    weekendDays: [5, 6], // Friday + Saturday
    holidays: ['2026-12-25'],
  },
}
```

## Week start (for week expressions)

The first day of the week is set via the `weekStartsOn` property in [`Calendar Options`](https://www.adaptabletools.com/docs/reference/calendaroptions.md).

### `weekStartsOn`

First day of the week for week-related Expression Functions

Honoured by `WEEK`, `START_OF_WEEK` and `IS_THIS_WEEK`. Uses JavaScript `Date.getDay()` values: `0` = Sunday … `6` = Saturday.

Independent of `weekendDays` — for example Monday-start weeks with Saturday / Sunday weekends:

```ts {3,4}
const adaptableOptions: AdaptableOptions = {
  calendarOptions: {
    weekStartsOn: 1, // Monday
    weekendDays: [0, 6],
  },
}
```

## Expression Functions that use the calendar

These AdapTableQL functions honour `holidays` and `weekendDays`:

- `IS_WORKDAY` / `IS_HOLIDAY`
- `IS_NEXT_WORKDAY` / `IS_PREV_WORKDAY`
- `WORKDAY` / `NETWORKDAYS` (Expression Editor)

Datepicker **Next Workday** / **Prev Workday** buttons use the same rules.

**Example: Providing Custom Holidays**

Setting Holidays and Working Days in AdapTable

- This demo shows how to provide AdapTable with custom holidays
- The Grid contains one row per date from 22 December 2026 to 3 January 2027
- Three of those dates are holidays: Christmas Day (25 Dec), Boxing Day (26 Dec) and New Year's Day (1 Jan)
- The Layout applies an `IS_WORKDAY` Column Filter, so the holidays (and weekends) are excluded
### Expand to see Calendar definitions

```ts
calendarOptions: {
  holidays: [
    new Date(2026, 11, 25),
    new Date(2026, 11, 26),
    new Date(2027, 0, 1),
  ],
},
```

Demo project (Vanilla); the files without a marker are shown below:

```text
src/
  adaptableOptions.ts
  agGridModules.ts     [template]
  columnDefs.ts
  gridOptions.ts
  index.ts             [template]
  onAdaptableReady.ts
  rowData.ts
  styles.css           [template]
index.html             [template]
package.json           [template]
tsconfig.json          [template]
```

Files marked `[template]` are the same in every demo; see the [demo template](https://www.adaptabletools.com/llms/demo-template.md#vanilla).

**`src/adaptableOptions.ts`**

```ts
import {AdaptableOptions} from '@adaptabletools/adaptable';

import {TradeInfo} from './rowData';

export const adaptableOptions: AdaptableOptions<TradeInfo> = {
  primaryKey: 'tradeId',
  userName: 'Demo User',
  adaptableId: 'Holiday Calendars',

  calendarOptions: {
    holidays: [
      new Date(2026, 11, 25),
      new Date(2026, 11, 26),
      new Date(2027, 0, 1),
    ],
  },
  initialState: {
    Dashboard: {
      Tabs: [
        {
          Name: 'Demo',
          Toolbars: ['ColumnFilter'],
        },
      ],
    },
    Theme: {CurrentTheme: 'dark'},
    Layout: {
      CurrentLayout: 'Standard Layout',
      Layouts: [
        {
          Name: 'Standard Layout',
          TableColumns: ['tradeId', 'tradeDate'],
          ColumnSizing: {
            tradeId: {Width: 100},
            tradeDate: {Width: 350},
          },
          ColumnFilters: [
            {
              ColumnId: 'tradeDate',
              Expression: 'IS_WORKDAY([tradeDate])',
            },
          ],
        },
      ],
    },

    FormatColumn: {
      FormatColumns: [
        {
          Name: 'formatColumn-tradeDate',
          Scope: {
            ColumnIds: ['tradeDate'],
          },
          DisplayFormat: {
            Formatter: 'DateFormatter',
            Options: {
              Pattern: 'EEEE MMMM do yyyy',
            },
          },
        },
      ],
    },
  },
};
```

**`src/onAdaptableReady.ts`**

```ts
import {AdaptableReadyInfo} from '@adaptabletools/adaptable';
import {TradeInfo} from './rowData';

export const onAdaptableReady = ({adaptableApi}: AdaptableReadyInfo) => {
  // adaptableApi.gridApi.setGridData(getGridData());
};

function getGridData(): TradeInfo[] {
  let tradeInfo: TradeInfo[] = [];
  tradeInfo.push({
    tradeId: 1,
    tradeDate: new Date(2026, 11, 22),
  });
  tradeInfo.push({
    tradeId: 2,
    tradeDate: new Date(2026, 11, 23),
  });
  tradeInfo.push({
    tradeId: 3,
    tradeDate: new Date(2026, 11, 24),
  });
  tradeInfo.push({
    tradeId: 4,
    tradeDate: new Date(2026, 11, 25),
  });
  tradeInfo.push({
    tradeId: 5,
    tradeDate: new Date(2026, 11, 26),
  });
  tradeInfo.push({
    tradeId: 6,
    tradeDate: new Date(2026, 11, 27),
  });

  return tradeInfo;
}
```

**`src/gridOptions.ts`**

```ts
import {GridOptions, themeBalham} from 'ag-grid-enterprise';
import {rowData} from './rowData';
import {columnDefs} from './columnDefs';

export const gridOptions: GridOptions = {
  theme: themeBalham,
  defaultColDef: {
    sortable: true,
    filter: true,
    floatingFilter: true,
    enableRowGroup: true,
  },
  columnDefs: columnDefs,
  rowData: rowData,
  sideBar: true,
};
```

**`src/columnDefs.ts`**

```ts
import {ColDef} from 'ag-grid-enterprise';

export const columnDefs: ColDef[] = [
  {
    field: 'tradeId',
    cellDataType: 'number',
  },
  {
    field: 'tradeDate',
    cellDataType: 'date',
  },
];
```

**`src/rowData.ts`**

```ts
export interface TradeInfo {
  tradeId: number;
  tradeDate: Date;
}

export const rowData = [
  {
    tradeId: 1,
    tradeDate: new Date(2026, 11, 22),
  },
  {
    tradeId: 2,
    tradeDate: new Date(2026, 11, 23),
  },
  {
    tradeId: 3,
    tradeDate: new Date(2026, 11, 24),
  },
  {
    tradeId: 4,
    tradeDate: new Date(2026, 11, 25),
  },
  {
    tradeId: 5,
    tradeDate: new Date(2026, 11, 26),
  },
  {
    tradeId: 6,
    tradeDate: new Date(2026, 11, 27),
  },
  {
    tradeId: 7,
    tradeDate: new Date(2026, 11, 28),
  },
  {
    tradeId: 8,
    tradeDate: new Date(2026, 11, 29),
  },
  {
    tradeId: 9,
    tradeDate: new Date(2026, 11, 30),
  },
  {
    tradeId: 10,
    tradeDate: new Date(2026, 11, 31),
  },
  {
    tradeId: 11,
    tradeDate: new Date(2027, 0, 1),
  },
  {
    tradeId: 12,
    tradeDate: new Date(2027, 0, 2),
  },
  {
    tradeId: 13,
    tradeDate: new Date(2027, 0, 3),
  },
];
```

The full property list is in the [Calendar Technical Reference](https://www.adaptabletools.com/docs/technical-reference-calendar/index.md)
