Skip to content
← Projects

Hijri

One Hijri engine. Every major date library.

A single, rigorously-tested Umm al-Qura Hijri calendar engine, with thin lock-step adapters for every major JavaScript date and time library. Pure TypeScript, dual CJS and ESM, fully typed.

Quick start

import { toHijri, toGregorian } from 'hijri-core';

// Gregorian → Hijri (Umm al-Qura, default)
toHijri(new Date(2025, 2, 1));   // { hy: 1446, hm: 9, hd: 1 }

// Hijri → Gregorian
toGregorian(1446, 9, 1);          // 2025-03-01

// FCNA/ISNA calendar variant
toHijri(new Date('2025-03-01'), { calendar: 'fcna' });

Adapters for every stack

Built to best practices

One engine, zero drift

Every adapter calls hijri-core and adds no calendar logic. They release in lock-step, so a date converts identically everywhere.

Pure TypeScript

Strict TypeScript with TSDoc on every export. No untyped surfaces.

Dual CJS + ESM

Distributed as both module formats via tsup — Node, bundlers, and the browser.

peerDependencies

Adapters list their host library as a peer, so it is never double-bundled.

Zero core deps

hijri-core ships with no runtime dependencies.

CI on Node 20 / 22 / 24

85–90% coverage targets enforced per package.