No description
Find a file
Aric Camarata 6caa9eed2c ci: fix eslint config, add missing ts-eslint devDeps, format src
- Add @typescript-eslint/parser and @typescript-eslint/eslint-plugin to
  devDependencies (required by eslint.config.mjs direct imports and by
  @acamarata/eslint-config peerDependencies)
- Fix eslint.config.mjs: scope files to src/**/*.ts, add parserOptions.project
  for type-aware rules, expand ignores to cover coverage/ and docs/
- Run prettier --write src/ to fix format:check failures
2026-05-31 08:47:31 -04:00
.github chore: P1 compliance updates (AGENTS.md symlink, docs, types) 2026-05-30 18:38:10 -04:00
src ci: fix eslint config, add missing ts-eslint devDeps, format src 2026-05-31 08:47:31 -04:00
.editorconfig feat: initial release of hijri-core v1.0.0 2026-02-25 14:06:02 -05:00
.gitignore chore: corepack migration + typedoc config + ADR-015 CI updates (P1) 2026-05-29 07:15:57 -04:00
.npmrc chore: clear .npmrc to remove pnpm-only key that warns on npm publish 2026-02-25 15:08:47 -05:00
.nvmrc feat: initial release of hijri-core v1.0.0 2026-02-25 14:06:02 -05:00
CHANGELOG.md chore: bump to v1.0.2 2026-05-30 19:12:04 -04:00
eslint.config.mjs ci: fix eslint config, add missing ts-eslint devDeps, format src 2026-05-31 08:47:31 -04:00
LICENSE feat: initial release of hijri-core v1.0.0 2026-02-25 14:06:02 -05:00
package.json ci: fix eslint config, add missing ts-eslint devDeps, format src 2026-05-31 08:47:31 -04:00
pnpm-lock.yaml ci: fix eslint config, add missing ts-eslint devDeps, format src 2026-05-31 08:47:31 -04:00
pnpm-workspace.yaml feat: initial release of hijri-core v1.0.0 2026-02-25 14:06:02 -05:00
README.md chore: P1 compliance updates (AGENTS.md symlink, docs, types) 2026-05-30 18:38:10 -04:00
test-cjs.cjs refactor: code quality improvements across the board 2026-03-08 11:38:10 -04:00
test.mjs refactor: code quality improvements across the board 2026-03-08 11:38:10 -04:00
tsconfig.json chore: adopt shared config packages (tsconfig, eslint, prettier) 2026-05-30 15:07:38 -04:00
tsup.config.ts feat: initial release of hijri-core v1.0.0 2026-02-25 14:06:02 -05:00
typedoc.json docs: add TypeDoc API generation (typedoc@0.28.19 + typedoc-plugin-markdown@4.11.0) 2026-05-30 16:41:58 -04:00

hijri-core

npm CI license wiki

Zero-dependency Hijri calendar engine for JavaScript and TypeScript. Supports the Umm al-Qura (UAQ) and FCNA/ISNA calendars out of the box. A pluggable registry lets you add custom calendar implementations at runtime.

Installation

npm install hijri-core

Quick Start

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

// Gregorian to Hijri (UAQ, default)
const hijri = toHijri(new Date(2025, 2, 1));
// { hy: 1446, hm: 9, hd: 1 }

// Hijri to Gregorian
const greg = toGregorian(1446, 9, 1);
// Date: 2025-03-01

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

// Validation and month length
isValidHijriDate(1444, 9, 1); // true
daysInHijriMonth(1444, 9);    // 29

Custom Calendars

Implement CalendarEngine and call registerCalendar('my-id', engine). Pass { calendar: 'my-id' } to any conversion function.

TypeScript

import type { HijriDate, HijriYearRecord, CalendarEngine, ConversionOptions } from 'hijri-core';

Documentation

Full API reference, architecture notes, and calendar background: GitHub Wiki

Acknowledgments

The Umm al-Qura table is derived from data published by the King Abdulaziz City for Science and Technology (KACST). The FCNA new moon algorithm follows Jean Meeus, "Astronomical Algorithms," 2nd ed., Chapter 49.

License

MIT. Copyright (c) 2024-2026 Aric Camarata.