mirror of
https://github.com/acamarata/temporal-hijri.git
synced 2026-07-02 03:40:42 +00:00
style: fix prettier table formatting in wiki
This commit is contained in:
parent
69b08f5971
commit
f0e2985849
3 changed files with 42 additions and 42 deletions
|
|
@ -5,16 +5,16 @@
|
||||||
```typescript
|
```typescript
|
||||||
// Classes
|
// Classes
|
||||||
export { HijriCalendar } from 'temporal-hijri';
|
export { HijriCalendar } from 'temporal-hijri';
|
||||||
export { UaqCalendar } from 'temporal-hijri';
|
export { UaqCalendar } from 'temporal-hijri';
|
||||||
export { FcnaCalendar } from 'temporal-hijri';
|
export { FcnaCalendar } from 'temporal-hijri';
|
||||||
|
|
||||||
// Singletons
|
// Singletons
|
||||||
export { uaqCalendar } from 'temporal-hijri'; // new UaqCalendar()
|
export { uaqCalendar } from 'temporal-hijri'; // new UaqCalendar()
|
||||||
export { fcnaCalendar } from 'temporal-hijri'; // new FcnaCalendar()
|
export { fcnaCalendar } from 'temporal-hijri'; // new FcnaCalendar()
|
||||||
|
|
||||||
// Types (re-exported from hijri-core)
|
// Types (re-exported from hijri-core)
|
||||||
export type { HijriDate, ConversionOptions } from 'temporal-hijri';
|
export type { HijriDate, ConversionOptions } from 'temporal-hijri';
|
||||||
export type { HijriCalendarOptions } from 'temporal-hijri';
|
export type { HijriCalendarOptions } from 'temporal-hijri';
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -36,7 +36,7 @@ Accepts any engine registered via hijri-core's `registerCalendar()`. The calenda
|
||||||
## `UaqCalendar`
|
## `UaqCalendar`
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
new UaqCalendar()
|
new UaqCalendar();
|
||||||
```
|
```
|
||||||
|
|
||||||
Wraps the `uaq` engine from hijri-core. Calendar ID: `"hijri-uaq"`.
|
Wraps the `uaq` engine from hijri-core. Calendar ID: `"hijri-uaq"`.
|
||||||
|
|
@ -46,7 +46,7 @@ Wraps the `uaq` engine from hijri-core. Calendar ID: `"hijri-uaq"`.
|
||||||
## `FcnaCalendar`
|
## `FcnaCalendar`
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
new FcnaCalendar()
|
new FcnaCalendar();
|
||||||
```
|
```
|
||||||
|
|
||||||
Wraps the `fcna` engine from hijri-core. Calendar ID: `"hijri-fcna"`.
|
Wraps the `fcna` engine from hijri-core. Calendar ID: `"hijri-fcna"`.
|
||||||
|
|
@ -59,38 +59,38 @@ All methods are available on `HijriCalendar`, `UaqCalendar`, and `FcnaCalendar`.
|
||||||
|
|
||||||
### Field accessors
|
### Field accessors
|
||||||
|
|
||||||
| Method | Signature | Returns | Notes |
|
| Method | Signature | Returns | Notes |
|
||||||
|---|---|---|---|
|
| ----------- | ----------------------------- | ---------------------- | ----------- |
|
||||||
| `year` | `(date: PlainDate) => number` | Hijri year | |
|
| `year` | `(date: PlainDate) => number` | Hijri year | |
|
||||||
| `month` | `(date: PlainDate) => number` | Hijri month (1-12) | |
|
| `month` | `(date: PlainDate) => number` | Hijri month (1-12) | |
|
||||||
| `monthCode` | `(date: PlainDate) => string` | `"M01"` – `"M12"` | Zero-padded |
|
| `monthCode` | `(date: PlainDate) => string` | `"M01"` – `"M12"` | Zero-padded |
|
||||||
| `day` | `(date: PlainDate) => number` | Day of month (1-29/30) | |
|
| `day` | `(date: PlainDate) => number` | Day of month (1-29/30) | |
|
||||||
|
|
||||||
### Year and month metrics
|
### Year and month metrics
|
||||||
|
|
||||||
| Method | Signature | Returns | Notes |
|
| Method | Signature | Returns | Notes |
|
||||||
|---|---|---|---|
|
| -------------- | ------------------------------ | ---------------------- | ---------------------------- |
|
||||||
| `daysInMonth` | `(date: PlainDate) => number` | 29 or 30 | Varies by month and calendar |
|
| `daysInMonth` | `(date: PlainDate) => number` | 29 or 30 | Varies by month and calendar |
|
||||||
| `daysInYear` | `(date: PlainDate) => number` | 354 or 355 | Sum of all 12 months |
|
| `daysInYear` | `(date: PlainDate) => number` | 354 or 355 | Sum of all 12 months |
|
||||||
| `monthsInYear` | `(date: PlainDate) => number` | Always 12 | |
|
| `monthsInYear` | `(date: PlainDate) => number` | Always 12 | |
|
||||||
| `inLeapYear` | `(date: PlainDate) => boolean` | `true` if 355-day year | |
|
| `inLeapYear` | `(date: PlainDate) => boolean` | `true` if 355-day year | |
|
||||||
|
|
||||||
### Week and day position
|
### Week and day position
|
||||||
|
|
||||||
| Method | Signature | Returns | Notes |
|
| Method | Signature | Returns | Notes |
|
||||||
|---|---|---|---|
|
| ------------ | ----------------------------- | ------------------ | --------------------- |
|
||||||
| `dayOfWeek` | `(date: PlainDate) => number` | 1-7 (Mon=1, Sun=7) | ISO weekday |
|
| `dayOfWeek` | `(date: PlainDate) => number` | 1-7 (Mon=1, Sun=7) | ISO weekday |
|
||||||
| `dayOfYear` | `(date: PlainDate) => number` | 1-354 or 1-355 | Within the Hijri year |
|
| `dayOfYear` | `(date: PlainDate) => number` | 1-354 or 1-355 | Within the Hijri year |
|
||||||
| `weekOfYear` | `(date: PlainDate) => number` | 1-51 | `ceil(dayOfYear / 7)` |
|
| `weekOfYear` | `(date: PlainDate) => number` | 1-51 | `ceil(dayOfYear / 7)` |
|
||||||
| `daysInWeek` | `(date: PlainDate) => number` | Always 7 | |
|
| `daysInWeek` | `(date: PlainDate) => number` | Always 7 | |
|
||||||
|
|
||||||
### Construction from fields
|
### Construction from fields
|
||||||
|
|
||||||
| Method | Signature | Returns |
|
| Method | Signature | Returns |
|
||||||
|---|---|---|
|
| --------------------- | ---------------------------------------------------------- | -------------------- |
|
||||||
| `dateFromFields` | `(fields: {year, month, day}, options?) => PlainDate` | ISO `PlainDate` |
|
| `dateFromFields` | `(fields: {year, month, day}, options?) => PlainDate` | ISO `PlainDate` |
|
||||||
| `yearMonthFromFields` | `(fields: {year, month}, options?) => PlainYearMonth` | ISO `PlainYearMonth` |
|
| `yearMonthFromFields` | `(fields: {year, month}, options?) => PlainYearMonth` | ISO `PlainYearMonth` |
|
||||||
| `monthDayFromFields` | `(fields: {month, day, year?}, options?) => PlainMonthDay` | ISO `PlainMonthDay` |
|
| `monthDayFromFields` | `(fields: {month, day, year?}, options?) => PlainMonthDay` | ISO `PlainMonthDay` |
|
||||||
|
|
||||||
`monthDayFromFields` uses year 1444 AH as a default reference if no year is supplied.
|
`monthDayFromFields` uses year 1444 AH as a default reference if no year is supplied.
|
||||||
|
|
||||||
|
|
@ -124,10 +124,10 @@ Computes the difference between two dates. When `largestUnit` is `'years'` or `'
|
||||||
|
|
||||||
### Other
|
### Other
|
||||||
|
|
||||||
| Method | Signature | Returns |
|
| Method | Signature | Returns |
|
||||||
|---|---|---|
|
| ------------- | -------------------------------------- | ------------------- |
|
||||||
| `mergeFields` | `(fields, additionalFields) => Record` | Merged field object |
|
| `mergeFields` | `(fields, additionalFields) => Record` | Merged field object |
|
||||||
| `toString` | `() => string` | Calendar identifier |
|
| `toString` | `() => string` | Calendar identifier |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -113,12 +113,12 @@ hijri-core provides:
|
||||||
|
|
||||||
The package ships two formats from a single TypeScript source:
|
The package ships two formats from a single TypeScript source:
|
||||||
|
|
||||||
| File | Format | Usage |
|
| File | Format | Usage |
|
||||||
|---|---|---|
|
| ------------------ | ----------------------- | --------------------------------------------------- |
|
||||||
| `dist/index.mjs` | ESM | `import { uaqCalendar } from 'temporal-hijri'` |
|
| `dist/index.mjs` | ESM | `import { uaqCalendar } from 'temporal-hijri'` |
|
||||||
| `dist/index.cjs` | CommonJS | `const { uaqCalendar } = require('temporal-hijri')` |
|
| `dist/index.cjs` | CommonJS | `const { uaqCalendar } = require('temporal-hijri')` |
|
||||||
| `dist/index.d.ts` | Type declarations (CJS) | TypeScript + CJS |
|
| `dist/index.d.ts` | Type declarations (CJS) | TypeScript + CJS |
|
||||||
| `dist/index.d.mts` | Type declarations (ESM) | TypeScript + ESM |
|
| `dist/index.d.mts` | Type declarations (ESM) | TypeScript + ESM |
|
||||||
|
|
||||||
Both `hijri-core` and `@js-temporal/polyfill` are declared `external` in the build config and listed as peer dependencies. They are not bundled.
|
Both `hijri-core` and `@js-temporal/polyfill` are declared `external` in the build config and listed as peer dependencies. They are not bundled.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,10 @@ This package provides `UaqCalendar` and `FcnaCalendar` as plug-in calendar objec
|
||||||
|
|
||||||
## Calendar systems
|
## Calendar systems
|
||||||
|
|
||||||
| Calendar | ID | Description |
|
| Calendar | ID | Description |
|
||||||
|---|---|---|
|
| ----------- | ------------ | ---------------------------------------------------------- |
|
||||||
| Umm al-Qura | `hijri-uaq` | Official Saudi calendar, table-driven, covers 1318-1500 AH |
|
| Umm al-Qura | `hijri-uaq` | Official Saudi calendar, table-driven, covers 1318-1500 AH |
|
||||||
| FCNA/ISNA | `hijri-fcna` | North American standard, astronomical new moon calculation |
|
| FCNA/ISNA | `hijri-fcna` | North American standard, astronomical new moon calculation |
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue