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,
parseDateDetailed,
setDefaults,
toBanglaCalendar,
toHijriCalendar,
} from "@coreify/tarikh";
setDefaults({
locale: "bn-BD",
timeZone: "Asia/Dhaka",
hijriSystem: "islamic-umalqura",
});
parseDate("৩১ মার্চ ২০২৬");
parseDate("17 Chaitra 1432", { calendar: "bangla" });
parseDateDetailed("31 Mar 26", { strict: true });
format("2026-03-31", { preset: "date" });
format("2026-03-31", { mode: "bangla", locale: "bn-BD" });
format("2026-03-31", {
mode: "hijri",
timeZone: "UTC",
hijriSystem: "islamic-civil",
});
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 and Backend 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 |
hijriSystem: "islamic-umalqura" | Umm al-Qura backend |
hijriSystem: "islamic-civil" | Civil arithmetic backend |
Notes
format()is the highest-level entry point for server renderingparseDate()returnsDate | nullparseDateDetailed()returns success or failure metadata for validation flowstoDate()accepts the same Gregorian strings plusDateobjects and timestamps