Reference
Parsing and Server Use
Parse and format dates on the server with Tarikh, including Bangla and Hijri calendar conversion.
Start Here
Tarikh works directly on the server for formatting, parsing, and calendar conversion.
Quick Rule
If you are rendering data in loaders, server components, or scripts, this is the page to check.
import { format, parseDate, toBanglaCalendar, toHijriCalendar } from "@coreify/tarikh";
parseDate("৩১ মার্চ ২০২৬");
parseDate("17 Chaitra 1432", { calendar: "bangla" });
parseDate("2026-03-31T15:30:00Z");
format("2026-03-31", { mode: "standard" });
format("2026-03-31", { mode: "bangla", locale: "bn-BD" });
format("2026-03-31", { mode: "hijri", timeZone: "UTC" });
toBanglaCalendar("2026-03-31", { locale: "bn-BD" });
toHijriCalendar("2026-03-31", { timeZone: "UTC" });Input Shapes
| Input | Result |
|---|---|
Date | Normalized through toDate() |
| Timestamp | Accepted when finite and in range |
| Gregorian strings | ISO dates, common date formats, and timestamps |
| Bangla strings | Parsed when calendar: "bangla" is provided |
Supported Gregorian Formats
YYYY-MM-DDYYYY/MM/DDYYYY.MM.DDYYYY-M-D,YYYY/M/D,YYYY.M.DYYYY-MM-DDTHH:mm[:ss[.fraction]][Z|±HH:mm]DD Month YYYYMonth DD, YYYYDD-Month-YYYY- Bangla calendar strings like
17 Chaitra 1432 - Common Bangla month aliases like
Boishakh,Poush,Falgun, andAsharh
Timezone Control
| Setting | Effect |
|---|---|
| Default Hijri timezone | Asia/Dhaka |
timeZone: "UTC" | Uses the canonical UTC Hijri result |
HIJRI_TIME_ZONES | Runtime list and TypeScript union for supported zones |
Notes
format()is the highest-level entry point for server renderingparseDate()returns a nativeDatetoDate()accepts the same Gregorian strings plusDateobjects and timestamps