mirror of
https://github.com/acamarata/luxon-hijri.git
synced 2026-07-01 11:14:29 +00:00
Extract conversion logic to hijri-core. All Hijri algorithms now live in that package and are re-exported with identical signatures. Fix weekday, era, and time token bugs. Dual CJS/ESM build. Full test suite. CI and wiki workflows. Zero breaking API changes.
5.2 KiB
5.2 KiB
Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog.
[2.1.0] - 2026-02-25
Changed
- Engine logic extracted to
hijri-core(new dependency). All Hijri conversion algorithms now live in that package and are re-exported fromluxon-hijriwith identical signatures. Zero breaking changes to the public API. src/hDates.ts,src/hMonths.ts,src/hWeekdays.ts,src/fcna.ts,src/utils.ts,src/toHijri.ts,src/toGregorian.ts: all now delegate tohijri-core. The UAQ table, FCNA engine, month/weekday names, and conversion functions have a single source of truth across the hijri ecosystem.hijri-core ^1.0.0added as a runtime dependency.luxonstays as a runtime dependency (still needed byformatHijriDatefor time and timezone tokens).
[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.