diff --git a/.wiki/API-Reference.md b/.wiki/API-Reference.md index 1b6dc09..49d71e7 100644 --- a/.wiki/API-Reference.md +++ b/.wiki/API-Reference.md @@ -41,11 +41,11 @@ const h = moment(new Date(2023, 2, 23)).toHijri({ calendar: 'fcna' }); **HijriDate fields:** -| Field | Type | Description | -| --- | --- | --- | -| `hy` | `number` | Hijri year | -| `hm` | `number` | Hijri month (1 = Muharram, 12 = Dhul Hijjah) | -| `hd` | `number` | Hijri day (1-30) | +| Field | Type | Description | +| ----- | -------- | -------------------------------------------- | +| `hy` | `number` | Hijri year | +| `hm` | `number` | Hijri month (1 = Muharram, 12 = Dhul Hijjah) | +| `hd` | `number` | Hijri day (1-30) | --- @@ -89,7 +89,7 @@ Returns `true` if the date falls within the supported range of the chosen calend ```javascript moment(new Date(2023, 2, 23)).isValidHijri(); // => true -moment(new Date(1900, 0, 1)).isValidHijri(); // => false (before UAQ range) +moment(new Date(1900, 0, 1)).isValidHijri(); // => false (before UAQ range) ``` --- @@ -116,21 +116,21 @@ moment(new Date(2023, 2, 23)).formatHijri('iD iMMMM iYYYY [CE:] MMMM D, YYYY'); **Format tokens:** -| Token | Example output | Description | -| --- | --- | --- | -| `iYYYY` | `1444` | Hijri year, 4+ digits, zero-padded to 4 | -| `iYY` | `44` | Hijri year, last 2 digits, zero-padded | -| `iMMMM` | `Ramadan` | Month long name | -| `iMMM` | `Ramadan` | Month medium name | -| `iMM` | `09` | Month number, zero-padded | -| `iM` | `9` | Month number | -| `iDD` | `01` | Day, zero-padded | -| `iD` | `1` | Day | -| `iEEEE` | `Yawm al-Khamis` | Weekday long name | -| `iEEE` | `Kham` | Weekday short name | -| `iE` | `5` | Weekday numeric (1=Sunday, 7=Saturday) | -| `ioooo` | `AH` | Era, long | -| `iooo` | `AH` | Era, short | +| Token | Example output | Description | +| ------- | ---------------- | --------------------------------------- | +| `iYYYY` | `1444` | Hijri year, 4+ digits, zero-padded to 4 | +| `iYY` | `44` | Hijri year, last 2 digits, zero-padded | +| `iMMMM` | `Ramadan` | Month long name | +| `iMMM` | `Ramadan` | Month medium name | +| `iMM` | `09` | Month number, zero-padded | +| `iM` | `9` | Month number | +| `iDD` | `01` | Day, zero-padded | +| `iD` | `1` | Day | +| `iEEEE` | `Yawm al-Khamis` | Weekday long name | +| `iEEE` | `Kham` | Weekday short name | +| `iE` | `5` | Weekday numeric (1=Sunday, 7=Saturday) | +| `ioooo` | `AH` | Era, long | +| `iooo` | `AH` | Era, short | --- @@ -160,10 +160,10 @@ interface ConversionOptions { } ``` -| Calendar ID | Description | -| --- | --- | -| `uaq` | Umm al-Qura: official Saudi calendar, tabular, covers AH 1318-1500 | -| `fcna` | FCNA/ISNA: Fiqh Council of North America calculated calendar | +| Calendar ID | Description | +| ----------- | ------------------------------------------------------------------ | +| `uaq` | Umm al-Qura: official Saudi calendar, tabular, covers AH 1318-1500 | +| `fcna` | FCNA/ISNA: Fiqh Council of North America calculated calendar | Custom calendars can be registered with hijri-core's `registerCalendar()`. diff --git a/.wiki/Architecture.md b/.wiki/Architecture.md index 0bbe138..d1ab77e 100644 --- a/.wiki/Architecture.md +++ b/.wiki/Architecture.md @@ -42,7 +42,7 @@ The augmentation is emitted in the declaration files produced by tsup, so consum The regex is ordered longest-match-first to prevent prefix collisions: ```javascript -/iYYYY|iYY|iMMMM|iMMM|iMM|iM|iDD|iD|iEEEE|iEEE|iE|ioooo|iooo/g +/iYYYY|iYY|iMMMM|iMMM|iMM|iM|iDD|iD|iEEEE|iEEE|iE|ioooo|iooo/g; ``` `iYYYY` must appear before `iYY` for obvious reasons; `iMMMM` before `iMMM` and `iMM`; `iDD` before `iD`; `iEEEE` before `iEEE`. The global flag allows the regex to find all non-overlapping tokens in one pass. @@ -66,21 +66,21 @@ Because moment-hijri-plus uses hijri-core as a peer dependency, the registry is tsup produces four files: -| File | Format | Purpose | -| --- | --- | --- | -| `dist/index.cjs` | CommonJS | `require()` in Node.js and bundlers in CJS mode | -| `dist/index.mjs` | ESM | `import` in Node.js, Vite, Rollup, esbuild | -| `dist/index.d.ts` | CJS declaration | Types for CJS consumers (`require`) | -| `dist/index.d.mts` | ESM declaration | Types for ESM consumers (`import`) | +| File | Format | Purpose | +| ------------------ | --------------- | ----------------------------------------------- | +| `dist/index.cjs` | CommonJS | `require()` in Node.js and bundlers in CJS mode | +| `dist/index.mjs` | ESM | `import` in Node.js, Vite, Rollup, esbuild | +| `dist/index.d.ts` | CJS declaration | Types for CJS consumers (`require`) | +| `dist/index.d.mts` | ESM declaration | Types for ESM consumers (`import`) | Both `moment` and `hijri-core` are marked external, so they are not bundled. They resolve from the consumer's `node_modules` at runtime. ## Calendar coverage -| Calendar | ID | Range | Authority | -| --- | --- | --- | --- | -| Umm al-Qura | `uaq` | AH 1318-1500 (approx CE 1900-2076) | Official Saudi calendar | -| FCNA/ISNA | `fcna` | Calculated, no hard range | Fiqh Council of North America | +| Calendar | ID | Range | Authority | +| ----------- | ------ | ---------------------------------- | ----------------------------- | +| Umm al-Qura | `uaq` | AH 1318-1500 (approx CE 1900-2076) | Official Saudi calendar | +| FCNA/ISNA | `fcna` | Calculated, no hard range | Fiqh Council of North America | The UAQ calendar is tabular: dates are looked up in a precomputed table published by the Umm al-Qura University. Dates outside the table return `null`. The FCNA calendar uses an astronomical calculation rule and has no strict boundary.