UNPKG

@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.27 kB
/** * Return a zoned ISO 8601 datetime string with `amount` business days added to `value`. * * - Uses a fixed Monday–Friday business week (no locale awareness). Saturday–Sunday is * CLDR's world-default weekend; ISO 8601 defines no weekend. * - Has no calendar parameter, so no other weekend and no holidays. It is not the * zoned form of the plain `addBusinessDays`, which takes a `BusinessCalendar`. * - Saturday and Sunday are skipped during the count. * - Preserves the original time component through the operation. * - Returns "" on invalid input. * * @param value ISO 8601 zoned datetime string * @param amount number of business days to add * @returns Zoned ISO 8601 datetime string after adding business days, or "" on invalid input * * @example addZonedBusinessDays("2024-03-15T14:30:00+09:00[Asia/Tokyo]", 1) // "2024-03-18T14:30:00+09:00[Asia/Tokyo]" * @example addZonedBusinessDays("2024-03-16T14:30:00+09:00[Asia/Tokyo]", 1) // "2024-03-18T14:30:00+09:00[Asia/Tokyo]" * @example addZonedBusinessDays("2024-03-15T14:30:00+09:00[Asia/Tokyo]", 0) // "2024-03-15T14:30:00+09:00[Asia/Tokyo]" * @example addZonedBusinessDays("invalid", 1) // "" */ export declare function addZonedBusinessDays(value: string, amount: number): string;