@northguild/gmt
Version:
Date and time library for JavaScript and TypeScript, built on TC39 Temporal: time zones, DST, business days, ISO 8601 strings in and out. Never throws.
21 lines • 1.25 kB
TypeScript
import { BusinessCalendar } from "../types/business-calendar.js";
import "../types/index.js";
/**
* The shared body of `addBusinessDays` and `subtractBusinessDays`: validate, resolve the
* calendar, and walk `amount` working days from `value`.
*
* - `sign` is the direction a **positive** `amount` moves — `1` for adding, `-1` for
* subtracting — so a negative `amount` walks the other way in both.
* - `calendar` is optional; absent means Saturday–Sunday with no holidays.
* - Returns `""` on an invalid date, a non-integer or out-of-range `amount`, an invalid
* calendar, and when the walk runs past `MAX_BUSINESS_DAY_STEPS`.
*/
export declare function stepBusinessDaysValue(value: string, amount: number, sign: 1 | -1, calendar: BusinessCalendar | undefined): string;
/**
* The shared body of `nextBusinessDay` and `previousBusinessDay`: the first working day
* **strictly** one business day away from `value`, in `direction`.
*
* Unlike `stepBusinessDaysValue`, `calendar` is required — these two assume no weekend, so an
* absent calendar is invalid input rather than the Saturday–Sunday default.
*/
export declare function neighbourBusinessDayValue(value: string, direction: 1 | -1, calendar: BusinessCalendar): string;