addBusinessDays
Signature
Section titled “Signature”addBusinessDays(value: string, amount: number, calendar?: BusinessCalendar): stringReturn a PlainDate ISO string with amount working days added to value.
calendarnames the weekend days and holidays to skip. Omit it and GMT keeps its original fixed Monday–Friday week with no holidays. Pass one anywhere the weekend is not Saturday–Sunday — much of the Middle East is Friday–Saturday.- Negative
amountwalks backwards, soaddBusinessDays(value, -3, cal)andsubtractBusinessDays(value, 3, cal)agree. amountof 0 returnsvalueunchanged — including whenvalueis not itself a working day. UserollDateto move a non-working day onto one.valueis never counted, so adding 1 from a holiday lands on the next working day after it.valueandcalendar.holidaysare local dates;calendar.timeZoneis not read. A caller holding an instant reduces it to a local date first, withfloorToZone.- Returns "" on invalid input — including a fractional
amount, which names no whole number of working days — on an invalidcalendar, and when the walk runs past 200,000 calendar days (about 547 years) without finishing.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value | string | ISO PlainDate string |
amount | number | whole number of working days to add; negative walks backwards |
calendar | BusinessCalendar | optional BusinessCalendar; defaults to Monday–Friday with no holidays |
Returns
Section titled “Returns”ISO PlainDate string after adding working days, or "" on invalid input
Related types
Section titled “Related types”Examples
Section titled “Examples”import { addBusinessDays } from "@northguild/gmt/plain/calculate";
addBusinessDays("2024-03-15", 1) // "2024-03-18" (Friday to Monday)