Skip to content

Function: addHijri()

@taqwim/core


@taqwim/core / addHijri

addHijri(date, duration): HijriDateObject

Defined in: packages/core/src/lib/addHijri.ts:25

Adds a Hijri duration to a given Hijri date.

HijriDateObject

The Hijri date to which the duration will be added.

HijriDuration

The Hijri duration to add.

HijriDateObject

The new Hijri date after adding the duration.

// Add 10 days to 1 Ramadan 1445 ({ hy: 1445, hm: 9, hd: 1 })
const result = addHijri(
{ hy: 1445, hm: 9, hd: 1 },
{ years: 0, months: 0, weeks: 0, days: 10 }
)
//=> { hy: 1445, hm: 9, hd: 11 }
// Add 1 year, 2 months, 3 weeks, and 4 days to 1 Ramadan 1445 ({ hy: 1445, hm: 9, hd: 1 })
const result = addHijri(
{ hy: 1445, hm: 9, hd: 1 },
{ years: 1, months: 2, weeks: 3, days: 4 }
)
//=> { hy: 1446, hm: 11, hd: 25 }