mirror of
https://github.com/acamarata/luxon-hijri.git
synced 2026-06-30 18:54:28 +00:00
No description
| .claude | ||
| .github | ||
| src | ||
| .editorconfig | ||
| .gitignore | ||
| .npmrc | ||
| .nvmrc | ||
| .prettierrc | ||
| CHANGELOG.md | ||
| eslint.config.mjs | ||
| LICENSE | ||
| package.json | ||
| pnpm-lock.yaml | ||
| pnpm-workspace.yaml | ||
| README.md | ||
| test-cjs.cjs | ||
| test-crossval.mjs | ||
| test.mjs | ||
| tsconfig.json | ||
| tsup.config.ts | ||
luxon-hijri
Hijri/Gregorian date conversion and formatting for Luxon users. Thin adapter over hijri-core. Supports the Umm al-Qura calendar (1318-1500 AH, table-based) and the FCNA/ISNA calendar (astronomical, all Hijri years).
Installation
pnpm add luxon-hijri luxon hijri-core
# or
npm install luxon-hijri luxon hijri-core
Quick Start
import { toHijri, toGregorian, formatHijriDate } from 'luxon-hijri';
// Gregorian to Hijri (Umm al-Qura, default)
const h = toHijri(new Date(2023, 2, 23, 12));
// { hy: 1444, hm: 9, hd: 1 }
// Hijri to Gregorian
const g = toGregorian(1444, 9, 1);
// Date: 2023-03-23T00:00:00.000Z
// Format a Hijri date
formatHijriDate({ hy: 1444, hm: 9, hd: 1 }, 'iEEEE, iD iMMMM iYYYY ioooo');
// "Yawm al-Khamis, 1 Ramadan 1444 AH"
// FCNA/ISNA calendar
toHijri(new Date(2025, 2, 1, 12), { calendar: 'fcna' });
TypeScript
import { toHijri, toGregorian, formatHijriDate, isValidHijriDate } from 'luxon-hijri';
import type { HijriDate, CalendarSystem, ConversionOptions } from 'luxon-hijri';
Documentation
Full API reference, format token guide, calendar background, and architecture notes: GitHub Wiki
Related
- hijri-core: The underlying calendar engine
- pray-calc: Islamic prayer times
- nrel-spa: NREL Solar Position Algorithm
Acknowledgments
The Umm al-Qura table is derived from data published by KACST (King Abdulaziz City for Science and Technology). The FCNA new moon algorithm follows Jean Meeus, "Astronomical Algorithms," 2nd ed., Chapter 49.
License
MIT. Copyright (c) 2024-2026 Aric Camarata.