mirror of
https://github.com/acamarata/luxon-hijri.git
synced 2026-07-03 04:00:41 +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.
58 lines
4.4 KiB
Markdown
58 lines
4.4 KiB
Markdown
# Changelog
|
||
|
||
All notable changes to this project will be documented in this file.
|
||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
||
|
||
## [2.0.0] - 2026-02-25
|
||
|
||
### Added
|
||
|
||
- **FCNA/ISNA calendar support**: `toHijri`, `toGregorian`, and `isValidHijriDate` now 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'`) and `ConversionOptions` (`{ 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.ts` with named exported `HijriDate` and `HijriYearRecord` interfaces
|
||
- Exports: `hwLong`, `hwShort`, `hwNumeric` weekday arrays now public
|
||
- Exports: `HijriDate`, `HijriYearRecord`, `CalendarSystem`, `ConversionOptions` types exported from the package root
|
||
- `isValidHijriDate` now correctly handles the table sentinel entry (Hijri year 1501 boundary marker)
|
||
- Comprehensive test suite: `test.mjs` (ESM) and `test-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.yaml`
|
||
- `CHANGELOG.md`
|
||
|
||
### Fixed
|
||
|
||
- **Critical weekday bug**: `iE`, `iEEE`, `iEEEE` format tokens previously called `DateTime.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 via `toGregorian()` first, then call `DateTime.fromJSDate()` for weekday lookup.
|
||
- **Era tokens**: `iooo` and `ioooo` were delegated to Luxon's `toFormat()` 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 via `toGregorian()` + `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.
|
||
- **`toGregorian` timezone sensitivity**: Was using `DateTime.local()` to build the start date, which shifted the result by the host machine's UTC offset. Now uses `DateTime.utc()` for consistent UTC output across all environments.
|
||
- `README.md` license reference corrected from ISC to MIT.
|
||
|
||
### Changed
|
||
|
||
- **Breaking**: Package now ships dual ESM/CJS with a conditional `exports` map. The old `main: dist/index.js` entry is replaced by `main: dist/index.cjs` + `module: dist/index.mjs`. Bundlers and Node 20+ resolve automatically.
|
||
- **Breaking**: `hDates` interface renamed to `HijriYearRecord` (cleaner public API name).
|
||
- **Breaking**: Luxon upgraded from `^2.5.2` to `^3.5.0`.
|
||
- **Breaking**: `engines.node` set to `>=20` (Node 18 EOL April 2025).
|
||
- Build system changed from `tsc` to `tsup`. Manual `src/index.d.ts` deleted (tsup auto-generates).
|
||
- Package manager changed from npm to pnpm. `package-lock.json` replaced by `pnpm-lock.yaml`.
|
||
- `toHijri` lookup replaced with binary search (O(log 183) vs O(n) reduce+find).
|
||
- `toGregorian` lookup replaced with binary search on `hy` (O(log 183) vs O(n) find).
|
||
- `isValidHijriDate` lookup replaced with binary search (O(log 183) vs O(n) find).
|
||
- `author` field corrected to `"Aric Camarata"`.
|
||
- `repository.url` updated to use `git+https://` prefix (prevents npm publish warnings).
|
||
|
||
### Removed
|
||
|
||
- `@umalqura/core` runtime dependency (was unused in the implementation).
|
||
- `jest` and 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.
|