No description
Find a file
2026-06-13 11:52:36 -04:00
.github chore: E6 polish wiki + CI + TypeDoc integration (P1) 2026-05-30 18:38:38 -04:00
src fix: convert the displayed calendar date in toHijri for hijri-core's UTC-day contract 2026-06-10 16:35:37 -04:00
.editorconfig refactor: code quality improvements across the board 2026-03-08 11:37:44 -04:00
.gitignore chore: ignore coverage directory 2026-05-30 20:15:14 -04:00
.npmrc chore: clear .npmrc to remove pnpm-only key that warns on npm publish 2026-02-25 15:09:07 -05:00
.nvmrc feat: initial release of dayjs-hijri-plus v1.0.0 2026-02-25 14:15:07 -05:00
CHANGELOG.md chore: bump to v1.0.4 2026-06-13 11:52:36 -04:00
eslint.config.mjs ci: fix lint job — add @typescript-eslint parser/plugin devDeps, files pattern, typed linting 2026-05-31 08:48:31 -04:00
LICENSE feat: initial release of dayjs-hijri-plus v1.0.0 2026-02-25 14:15:07 -05:00
package.json chore: bump to v1.0.4 2026-06-13 11:52:36 -04:00
pnpm-lock.yaml chore: update hijri-core to 1.0.3 2026-06-10 16:49:50 -04:00
pnpm-workspace.yaml feat: initial release of dayjs-hijri-plus v1.0.0 2026-02-25 14:15:07 -05:00
README.md fix: convert the displayed calendar date in toHijri for hijri-core's UTC-day contract 2026-06-10 16:35:37 -04:00
test-cjs.cjs fix: convert the displayed calendar date in toHijri for hijri-core's UTC-day contract 2026-06-10 16:35:37 -04:00
test.mjs fix: convert the displayed calendar date in toHijri for hijri-core's UTC-day contract 2026-06-10 16:35:37 -04:00
tsconfig.json chore: adopt shared config packages (tsconfig, eslint, prettier) 2026-05-30 15:10:42 -04:00
tsup.config.ts ci: pin pnpm to version 10 in all CI jobs 2026-03-08 16:37:41 -04:00
typedoc.json docs: add TypeDoc API generation (typedoc@0.28.19 + typedoc-plugin-markdown@4.11.0) 2026-05-30 16:41:59 -04:00

dayjs-hijri-plus

npm version CI License: MIT

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.

Day boundaries and time zones

.toHijri() converts the calendar date the dayjs instance displays — the same date you would read off the screen — regardless of the host's system timezone or whether the dayjs utc plugin is active. A call like dayjs('2025-03-01').toHijri() always maps the 1st of March 2025, not whatever local instant that string resolves to in UTC.

Religious start-of-day at sunset is out of scope. Sunset-aware day boundaries require external prayer-time data and are not handled here.

  • 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.