-
Notifications
You must be signed in to change notification settings - Fork 0
formatHijriDate
github-actions[bot] edited this page May 30, 2026
·
1 revision
date-fns-hijri / formatHijriDate
formatHijriDate(
date,formatStr,options?):string
Defined in: src/index.ts:185
Format a Gregorian date using Hijri calendar tokens.
Supported tokens:
| Token | Output | Example |
|---|---|---|
| iYYYY | 4-digit Hijri year | 1444 |
| iYY | 2-digit Hijri year | 44 |
| iMMMM | Long month name | Ramadan |
| iMMM | Medium month name | Ramadan |
| iMM | Zero-padded month (01–12) | 09 |
| iM | Month (1–12) | 9 |
| iDD | Zero-padded day (01–30) | 01 |
| iD | Day (1–30) | 1 |
| iEEEE | Long weekday name | Yawm al-Khamis |
| iEEE | Short weekday name | Kham |
| iE | Numeric weekday (1=Sun–7=Sat) | 5 |
| ioooo | Long era | AH |
| iooo | Short era | AH |
Returns an empty string when the date falls outside the supported range.
Date
string
string
date-fns-hijri · MIT License · npm · Issues
Guides
Examples
Reference
API — Per Function
- toHijriDate
- fromHijriDate
- isValidHijriDate
- getHijriYear
- getHijriMonth
- getHijriDay
- getDaysInHijriMonth
- getHijriQuarter
- getHijriMonthName
- getHijriWeekdayName
- formatHijriDate
- addHijriMonths
- addHijriYears
- startOfHijriMonth
- endOfHijriMonth
- isSameHijriMonth
- isSameHijriYear
Community