Luxon-Hijri is a comprehensive Hijri date conversion and formatting library based on the Umm al-Qura calendar system, leveraging the power of Luxon for robust date manipulations. Please note this is a first draft but should work well. It was created quickly for a need I had within my own app but should be ready for contributions and more. I will add localization and more if requested or if someone contributes.
- Convert between Hijri and Gregorian dates.
- Format Hijri dates with customizable patterns.
- Locale support for different languages.
- Efficient and optimized for performance.
- Comprehensive unit testing for reliability.
npm install luxon-hijri
Here's how you can quickly convert a Gregorian date to a Hijri date:
import { toHijri } from 'luxon-hijri';
const hijriDate = toHijri(new Date());
console.log(hijriDate);
Convert Gregorian dates to Hijri:
import { toHijri } from 'luxon-hijri';
const hijriDate = toHijri(new Date(2023, 3, 14)); // April 14, 2023
console.log(hijriDate);
Convert Hijri dates to Gregorian:
import { toGregorian } from 'luxon-hijri';
const gregorianDate = toGregorian(1444, 9, 1); // 1st of Ramadan, 1444 H
console.log(gregorianDate);
Format Hijri dates using predefined patterns:
import { formatHijriDate } from 'luxon-hijri';
const formattedDate = formatHijriDate({ hy: 1444, hm: 9, hd: 1 }, 'iYYYY-iMM-iDD');
console.log(formattedDate); // 1444-09-01
For detailed documentation, examples, and API reference, visit [Documentation Link].
We welcome contributions! Please read our Contributing Guide for details on how to submit pull requests, report issues, and suggest enhancements.
This project is licensed under the ISC License - see the LICENSE.md file for details.
Participation in this project is governed by a Code of Conduct. We expect everyone to adhere to it to maintain a respectful and welcoming environment.