mirror of
https://github.com/acamarata/dayjs-hijri-plus.git
synced 2026-06-30 18:54:26 +00:00
No description
| .github | ||
| src | ||
| .editorconfig | ||
| .gitignore | ||
| .npmrc | ||
| .nvmrc | ||
| CHANGELOG.md | ||
| eslint.config.mjs | ||
| LICENSE | ||
| package.json | ||
| pnpm-lock.yaml | ||
| pnpm-workspace.yaml | ||
| README.md | ||
| test-cjs.cjs | ||
| test.mjs | ||
| tsconfig.json | ||
| tsup.config.ts | ||
| typedoc.json | ||
dayjs-hijri-plus
A Day.js plugin that adds Hijri calendar support. Converts Gregorian dates to and from Hijri, provides Hijri-aware formatting, and delegates all calendar logic to hijri-core.
Supports Umm al-Qura (UAQ) and FCNA/ISNA calendars. Custom engines can be registered at runtime.
Installation
pnpm add dayjs dayjs-hijri-plus hijri-core
Both dayjs and hijri-core are peer dependencies.
Quick Start
import dayjs from 'dayjs';
import hijriPlugin from 'dayjs-hijri-plus';
dayjs.extend(hijriPlugin);
const d = dayjs('2023-03-23');
d.toHijri(); // { hy: 1444, hm: 9, hd: 1 }
d.formatHijri('iD iMMMM iYYYY'); // '1 Ramadan 1444'
d.formatHijri('iYYYY-iMM-iDD'); // '1444-09-01'
dayjs.fromHijri(1444, 10, 1).format('YYYY-MM-DD'); // '2023-04-21'
Documentation
Full API reference, examples, and architecture notes are on the GitHub Wiki.
Related
- hijri-core: the zero-dependency Hijri calendar engine this plugin wraps
- luxon-hijri: the same conversion for Luxon users
- pray-calc: Islamic prayer time calculation
License
MIT. Copyright (c) 2026 Aric Camarata.