Skip to content

@livefolio/sdk / HolidayRule

Type Alias: HolidayRule

HolidayRule = object

Defined in: calendars/holiday-rules.ts:18

A year-derived holiday rule consumed by ExchangeCalendar. The rule is active only for years in the range [validFrom, validUntil] (both inclusive; omit either bound to leave it open).

resolve(year) returns the UTC midnight Date for the holiday in that year, or null if the holiday does not occur that year (e.g. a conditional rule for Good Friday in certain years). When observe is true, a Saturday result is moved to Friday and a Sunday result is moved to Monday (standard US-style holiday observation).

Properties

name

name: string

Defined in: calendars/holiday-rules.ts:20

Human-readable name, used for debugging and logging.


observe?

optional observe?: boolean

Defined in: calendars/holiday-rules.ts:28

When true, Saturday dates are moved to Friday, Sunday dates to Monday.


resolve

resolve: (year) => Date | null

Defined in: calendars/holiday-rules.ts:22

Returns the UTC midnight Date for this holiday in year, or null to skip.

Parameters

ParameterType
yearnumber

Returns

Date | null


validFrom?

optional validFrom?: number

Defined in: calendars/holiday-rules.ts:24

First year (inclusive) this rule applies. Defaults to −∞.


validUntil?

optional validUntil?: number

Defined in: calendars/holiday-rules.ts:26

Last year (inclusive) this rule applies. Defaults to +∞.

Released under the MIT License.