Skip to content

subtractZonedBusinessDays

subtractZonedBusinessDays(value: string, amount: number): string
import { subtractZonedBusinessDays } from "@northguild/gmt/zoned/calculate";

Return a zoned ISO 8601 datetime string with amount business days subtracted from value.

  • Uses fixed ISO Monday–Friday business days (no locale awareness).
  • Saturday and Sunday are skipped during the count.
  • Preserves the original time component through the operation.
  • Returns “” on invalid input.
Parameter Type Description
value string ISO 8601 zoned datetime string
amount number number of business days to subtract

Zoned ISO 8601 datetime string after subtracting business days, or “” on invalid input

subtractZonedBusinessDays("2024-03-18T14:30:00-04:00[America/New_York]", 1) // "2024-03-15T14:30:00-04:00[America/New_York]"
subtractZonedBusinessDays("2024-03-18T14:30:00-04:00[America/New_York]", 2) // "2024-03-14T14:30:00-04:00[America/New_York]"
subtractZonedBusinessDays("2024-03-18T14:30:00-04:00[America/New_York]", 0) // "2024-03-18T14:30:00-04:00[America/New_York]"
subtractZonedBusinessDays("invalid", 1) // ""

zoned/calculate/subtractZonedBusinessDays.ts