mirror of
https://github.com/acamarata/luxon-hijri.git
synced 2026-06-30 18:54:28 +00:00
Core fixes:
- Fix critical weekday bug: iE/iEEE/iEEEE tokens used Hijri year as Gregorian,
returning weekdays ~580 years wrong. Now converts via toGregorian() first.
- Fix era tokens iooo/ioooo: were returning Gregorian era, now always return "AH".
- Fix toGregorian timezone sensitivity: was using DateTime.local(), now DateTime.utc().
- Fix format token regex: word-boundary approach caused partial matches.
New: FCNA/ISNA calendar support:
- toHijri, toGregorian, isValidHijriDate now accept { calendar: 'fcna' } option.
- FCNA criterion: conjunction before 12:00 UTC → month starts D+1, else D+2.
- New moon times from Meeus Ch.49 full formula (accurate to within minutes, 1000–3000 CE).
- Works for all Hijri years, not just the 1318–1500 UAQ table range.
- Anchor: UAQ table for in-range years, Islamic epoch estimate for out-of-range.
- Exports: CalendarSystem, ConversionOptions types.
Build and infrastructure:
- pnpm replaces npm; tsup replaces tsc for dual CJS/ESM output.
- Exports map with types-first conditional exports for import/require.
- Binary search O(log 183) replaces linear O(n) scan in all three functions.
- Luxon upgraded from ^2.5.2 to ^3.5.0; TypeScript from ^4 to ^5.5.
- CI: Node 20/22/24 matrix, typecheck, and pack-check jobs.
- GitHub Wiki: four pages synced via Actions on push.
- Test suite: 81 ESM tests + 24 CJS tests, verified against ISNA 2023–2025 calendars.
- Exports hwLong, hwShort, hwNumeric weekday arrays.
Breaking changes:
- Dual ESM/CJS exports map (CJS consumers: no change via main field).
- HijriYearRecord replaces hDates interface name.
- Luxon peer dep bumped to ^3.5.0.
- Node >=20 required.
4.4 KiB
4.4 KiB
Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog.
[2.0.0] - 2026-02-25
Added
- FCNA/ISNA calendar support:
toHijri,toGregorian, andisValidHijriDatenow accept an optional{ calendar: 'fcna' }option. The FCNA criterion: if the astronomical conjunction occurs before 12:00 UTC the month begins D+1, otherwise D+2. New moon times use the full Meeus Chapter 49 formula (accurate to within a few minutes for 1000–3000 CE). The FCNA calendar works for all Hijri years, not just the 1318–1500 H range covered by the UAQ table. - New exported types:
CalendarSystem('uaq' | 'fcna') andConversionOptions({ calendar?: CalendarSystem }). src/fcna.ts: standalone FCNA engine — Meeus Ch.49 new moon algorithm, UAQ anchor lookup, FCNA criterion, and full Hijri↔Gregorian conversion without external dependencies beyond the existing hDatesTable.- Dual CJS and ESM build via tsup (
dist/index.cjs,dist/index.mjs) - Full TypeScript declarations for both module formats (
dist/index.d.ts,dist/index.d.mts) src/types.tswith named exportedHijriDateandHijriYearRecordinterfaces- Exports:
hwLong,hwShort,hwNumericweekday arrays now public - Exports:
HijriDate,HijriYearRecord,CalendarSystem,ConversionOptionstypes exported from the package root isValidHijriDatenow correctly handles the table sentinel entry (Hijri year 1501 boundary marker)- Comprehensive test suite:
test.mjs(ESM) andtest-cjs.cjs(CJS), including FCNA test cases verified against ISNA 2024–2025 calendar announcements - CI workflow: Node 20/22/24 matrix, typecheck, and pack-check jobs
- GitHub Wiki with four pages: Home, API Reference, Architecture, Hijri Calendar Background
.editorconfig,.nvmrc(24),.npmrc,pnpm-workspace.yamlCHANGELOG.md
Fixed
- Critical weekday bug:
iE,iEEE,iEEEEformat tokens previously calledDateTime.fromObject({ year: hijriDate.hy, ... })which Luxon interprets as Gregorian, returning dates in the year ~1444 CE (January 1444 CE is ~580 years ago). Every weekday result was wrong. Fix: convert Hijri to Gregorian viatoGregorian()first, then callDateTime.fromJSDate()for weekday lookup. - Era tokens:
ioooandioooowere delegated to Luxon'stoFormat()which returned Gregorian era strings. Both now return"AH"directly. - Time/timezone tokens: These also used the broken
DateTime.fromObject()path. Now use a lazily computed Gregorian DateTime viatoGregorian()+DateTime.fromJSDate(). - Format token regex: Previous word-boundary (
\b) regex caused partial token matches and missed some tokens. Replaced with an ordered alternation that matches longest tokens first. toGregoriantimezone sensitivity: Was usingDateTime.local()to build the start date, which shifted the result by the host machine's UTC offset. Now usesDateTime.utc()for consistent UTC output across all environments.README.mdlicense reference corrected from ISC to MIT.
Changed
- Breaking: Package now ships dual ESM/CJS with a conditional
exportsmap. The oldmain: dist/index.jsentry is replaced bymain: dist/index.cjs+module: dist/index.mjs. Bundlers and Node 20+ resolve automatically. - Breaking:
hDatesinterface renamed toHijriYearRecord(cleaner public API name). - Breaking: Luxon upgraded from
^2.5.2to^3.5.0. - Breaking:
engines.nodeset to>=20(Node 18 EOL April 2025). - Build system changed from
tsctotsup. Manualsrc/index.d.tsdeleted (tsup auto-generates). - Package manager changed from npm to pnpm.
package-lock.jsonreplaced bypnpm-lock.yaml. toHijrilookup replaced with binary search (O(log 183) vs O(n) reduce+find).toGregorianlookup replaced with binary search onhy(O(log 183) vs O(n) find).isValidHijriDatelookup replaced with binary search (O(log 183) vs O(n) find).authorfield corrected to"Aric Camarata".repository.urlupdated to usegit+https://prefix (prevents npm publish warnings).
Removed
@umalqura/coreruntime dependency (was unused in the implementation).jestand related test infrastructure.typescript ^4.0.0(replaced with^5.5.0).src/index.d.ts(manual, incomplete, generated automatically by tsup).
[1.0.4] - 2024-01-01
Initial public release on npm. CommonJS only. Umm al-Qura table-based conversion with Luxon formatting.