Skip to content

Function: addHijriBusinessDays()

@taqwim/core


@taqwim/core / addHijriBusinessDays

addHijriBusinessDays(date, amount, options): HijriDateObject

Defined in: packages/core/src/lib/addHijriBusinessDays.ts:33

HijriDateObject

The date to be changed

number

The amount of business days to be added.

BusinessDayOptions = {}

Business-day options, e.g. { weekend: [6, 0] } for a Sat/Sun weekend.

HijriDateObject

The new date with the business days added, or null if date is invalid.

addHijriBusinessDays

Add the specified number of business days to the given date, skipping weekend days. The weekend defaults to Friday/Saturday — the working week across most of the Arab world — and is configurable.

// Add 20 business days to 1 Ramadan 1445
addHijriBusinessDays({ hy: 1445, hm: 9, hd: 1 }, 20)
//=> { hy: 1445, hm: 9, hd: 29 }
// Western Saturday/Sunday weekend
addHijriBusinessDays({ hy: 1445, hm: 9, hd: 1 }, 5, { weekend: [6, 0] })