Skip to content

Function.businessDaysBetween

github-actions[bot] edited this page Nov 18, 2026 · 13 revisions

umt / businessDaysBetween

Function: businessDaysBetween()

businessDaysBetween(start, end, holidays?): number

Defined in: Date/businessDaysBetween.ts:25

Counts business days from start to end, using the same definition as isBusinessDay (weekdays that are not listed holidays). Days are compared by local calendar date; the time of day is ignored. The start day is excluded and the end day is included, so the result is the inverse of addBusinessDays: when end is a business day, addBusinessDays(start, businessDaysBetween(start, end, holidays), holidays) lands on the calendar day of end. When end is before start, the result is negative (the start day is still excluded and the end day is still included).

Parameters

start

Date

Start date (excluded)

end

Date

End date (included)

holidays?

Date[] = []

Optional holiday dates

Returns

number

Signed number of business days between the dates

Example

businessDaysBetween(new Date(2025, 3, 18), new Date(2025, 3, 21)); // 1 (Fri -> Mon)
businessDaysBetween(new Date(2025, 3, 21), new Date(2025, 3, 25)); // 4 (Mon -> Fri)
businessDaysBetween(new Date(2025, 3, 21), new Date(2025, 3, 18)); // -1

API

Classes

Interfaces

Type Aliases

Variables

Functions

Clone this wiki locally