Formatting
Hijri Formatting
Show a Hijri date with the right timezone and Bangla-localized output when needed.
Start Here
Use Hijri formatting when the Islamic calendar is the date people need to see.
Quick Rule
If you only need the finished string, call format(..., { mode: "hijri" }).
If you need the calendar parts, use toHijriCalendar().
What Changes
| Choice | Result |
|---|---|
| Default | Hijri output using Asia/Dhaka |
timeZone: "UTC" | Use the canonical UTC Hijri result |
locale: "bn-BD" | Bangla digits with the হিজরি suffix |
Example
import { HIJRI_TIME_ZONES, format, toHijriCalendar } from "@coreify/tarikh";
const [defaultHijriZone, utcHijriZone] = HIJRI_TIME_ZONES;
toHijriCalendar("2026-03-31");
// -> { day: 11, month: "Shawwal", monthIndex: 10, year: 1447 }
toHijriCalendar("2026-03-31", { timeZone: "UTC" });
// -> { day: 11, month: "Shawwal", monthIndex: 10, year: 1447 }
format("2026-03-31", { mode: "hijri" });
// -> "12th Shawwal 1447 AH"
format("2026-03-31", { mode: "hijri", timeZone: "UTC" });
// -> "11th Shawwal 1447 AH"
format("2026-03-31", { mode: "hijri", locale: "bn-BD" });
// -> "১২ই শাওয়াল ১৪৪৭ হিজরি"Good Fit
This is useful for calendars, religious dates, and any place where the Hijri date should be visible to users.