Holiday Calendars

A Holiday Calendar defines site-wide holiday dates and optional partial-day windows that scheduled resources skip.

List Holiday Calendars

SDK Method

\Files\Model\HolidayCalendar::list;

Return Object

HolidayCalendar[]

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Additional Arguments

Example Request

try {
  $holiday_calendars = \Files\Model\HolidayCalendar::list();
  foreach ($holiday_calendars as $holiday_calendar) {
    // Operate on $holiday_calendar
  }
} catch (\Files\NotAuthenticated\InvalidUsernameOrPasswordException $e) {
  echo 'Authentication Error Occurred (' . get_class($e) . '): ', $e->getMessage(), "\n";
} catch (\Files\FilesException $e) {
  echo 'Unknown Error Occurred (' . get_class($e) . '): ', $e->getMessage(), "\n";
}

Show Holiday Calendar

SDK Method

\Files\Model\HolidayCalendar::find;

Return Object

HolidayCalendar

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Method Arguments

ArgumentDescription
id
int64
Required
Holiday Calendar ID.

Example Request

try {
  $holiday_calendar = \Files\Model\HolidayCalendar::find($id);
  // Operate on $holiday_calendar
} catch (\Files\NotAuthenticated\InvalidUsernameOrPasswordException $e) {
  echo 'Authentication Error Occurred (' . get_class($e) . '): ', $e->getMessage(), "\n";
} catch (\Files\FilesException $e) {
  echo 'Unknown Error Occurred (' . get_class($e) . '): ', $e->getMessage(), "\n";
}

Create Holiday Calendar

SDK Method

\Files\Model\HolidayCalendar::create;

Return Object

HolidayCalendar

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Method Arguments

ArgumentDescription
definition
object
Required
Holiday rules for the calendar.
name
string
Required
Holiday Calendar name.

Example Request

try {
  $holiday_calendar = \Files\Model\HolidayCalendar::create([
    'definition' => {"months":{"0":[{"name":"Good Friday","function":"easter(year)","function_modifier":-2}],"1":[{"name":"New Year's Day","mday":1,"observed":"to_weekday_if_weekend(date)"},{"name":"Third Monday","week":3,"wday":1}],"11":[{"name":"Thanksgiving","week":4,"wday":4}],"12":[{"name":"Christmas Eve Early Close","mday":24,"start_time":"13:00","end_time":"17:00","year_ranges":{"from":2026}}]}},
    'name' => "Company Holidays"
  ]);
  // Operate on $holiday_calendar
} catch (\Files\NotAuthenticated\InvalidUsernameOrPasswordException $e) {
  echo 'Authentication Error Occurred (' . get_class($e) . '): ', $e->getMessage(), "\n";
} catch (\Files\FilesException $e) {
  echo 'Unknown Error Occurred (' . get_class($e) . '): ', $e->getMessage(), "\n";
}

Update Holiday Calendar

SDK Method

$holiday_calendar->update;

Return Object

HolidayCalendar

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Method Arguments

ArgumentDescription
definition
object
Holiday rules for the calendar.
name
string
Holiday Calendar name.

Example Request

try {
  // Find the holiday_calendar object by its id.
  $holiday_calendar = \Files\Model\HolidayCalendar::find(id);
  $holiday_calendar->update([
    'definition' => {"months":{"0":[{"name":"Good Friday","function":"easter(year)","function_modifier":-2}],"1":[{"name":"New Year's Day","mday":1,"observed":"to_weekday_if_weekend(date)"},{"name":"Third Monday","week":3,"wday":1}],"11":[{"name":"Thanksgiving","week":4,"wday":4}],"12":[{"name":"Christmas Eve Early Close","mday":24,"start_time":"13:00","end_time":"17:00","year_ranges":{"from":2026}}]}}
  ]);
} catch (\Files\NotAuthenticated\InvalidUsernameOrPasswordException $e) {
  echo 'Authentication Error Occurred (' . get_class($e) . '): ', $e->getMessage(), "\n";
} catch (\Files\FilesException $e) {
  echo 'Unknown Error Occurred (' . get_class($e) . '): ', $e->getMessage(), "\n";
}

Delete Holiday Calendar

SDK Method

$holiday_calendar->delete;

Return Object

No return value.

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Example Request

try {
  // Find the holiday_calendar object by its id.
  $holiday_calendar = \Files\Model\HolidayCalendar::find(id);
  $holiday_calendar->delete();
} catch (\Files\NotAuthenticated\InvalidUsernameOrPasswordException $e) {
  echo 'Authentication Error Occurred (' . get_class($e) . '): ', $e->getMessage(), "\n";
} catch (\Files\FilesException $e) {
  echo 'Unknown Error Occurred (' . get_class($e) . '): ', $e->getMessage(), "\n";
}

The HolidayCalendar Object

Some of the methods above return a HolidayCalendar object. The attributes of this object are listed below.

AttributeDescription
id
int64
Holiday Calendar ID. Set a scheduled resource's holiday_region to custom_ followed by this ID to make it skip the days in this calendar.
name
string
Holiday Calendar name.
definition
object
Holiday rules for the calendar.
created_at
date-time
Creation time.
updated_at
date-time
Last update time.

definition

Holiday rules grouped by month. A definition may contain at most 366 rules and its encoded JSON may be at most 65535 bytes.

Definition fields

AttributeDescription
months
object
Required
Keys 1 through 12 contain rules for that month. Key 0 contains calculated-date rules. At most 366 rules are allowed across all months.

Example definition

{
  "months": {
    "0": [
      {
        "name": "Good Friday",
        "function": "easter(year)",
        "function_modifier": -2
      }
    ],
    "1": [
      {
        "name": "New Year's Day",
        "mday": 1,
        "observed": "to_weekday_if_weekend(date)"
      },
      {
        "name": "Third Monday",
        "week": 3,
        "wday": 1
      }
    ],
    "11": [
      {
        "name": "Thanksgiving",
        "week": 4,
        "wday": 4
      }
    ],
    "12": [
      {
        "name": "Christmas Eve Early Close",
        "mday": 24,
        "start_time": "13:00",
        "end_time": "17:00",
        "year_ranges": {
          "from": 2026
        }
      }
    ]
  }
}

Rule types

Common rule options

Year restrictions