# previousBusinessDay

Industry: Core

## Signature

```ts
previousBusinessDay(value: string, calendar: BusinessCalendar): string
```

Return the last working day **strictly before** `value`.

- Strictly before: called on a working day it returns the previous one, never `value` itself. For the on-or-before behaviour — leave a working day alone, move a non-working one backward — use `rollDate(value, "preceding", calendar)`.
- Equivalent to `subtractBusinessDays(value, 1, calendar)` for any valid calendar, but the calendar is **required** here: there is no Saturday–Sunday default to fall back on, because a weekend is never assumed.
- `value` may be any local date, working or not: being called from a weekend or a holiday is the normal case, not an error.
- `value` and `calendar.holidays` are local dates; `calendar.timeZone` is not read. A caller holding an instant reduces it to a local date first, with `floorToZone`.
- Returns `""` when `value` is not a valid ISO PlainDate, when `calendar` is not a valid `BusinessCalendar`, and when the walk runs past 200,000 calendar days without finding a working day.

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `value` | `string` | ISO PlainDate string to start from, excluded from the search |
| `calendar` | `BusinessCalendar` | BusinessCalendar naming the weekend days and holidays |

## Returns

ISO PlainDate string of the previous working day, or "" on invalid input

## Related types

- [`BusinessCalendar`](/gmt/reference/types/BusinessCalendar/)

## Examples

```ts
import { previousBusinessDay } from "@northguild/gmt/calendar/business";

previousBusinessDay("2024-07-05", { weekend: [6, 7], holidays: ["2024-07-04"], timeZone: "Africa/Kigali" }) // "2024-07-03" — skips the holiday
```

## Source

[calendar/business/previousBusinessDay.ts](https://github.com/northguild/gmt/blob/main/packages/gmt/src/calendar/business/previousBusinessDay.ts)
