Tarikh
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

InputResult
DateNormalized through toDate()
TimestampAccepted when finite and in range
Gregorian stringsISO dates, common date formats, and timestamps
Bangla stringsParsed when calendar: "bangla" is provided

Supported Gregorian Formats

  • YYYY-MM-DD
  • YYYY/MM/DD
  • YYYY.MM.DD
  • YYYY-M-D, YYYY/M/D, YYYY.M.D
  • YYYY-MM-DDTHH:mm[:ss[.fraction]][Z|±HH:mm]
  • DD Month YYYY
  • Month DD, YYYY
  • DD-Month-YYYY
  • Bangla calendar strings like 17 Chaitra 1432
  • Common Bangla month aliases like Boishakh, Poush, Falgun, and Asharh

Timezone Control

SettingEffect
Default Hijri timezoneAsia/Dhaka
timeZone: "UTC"Uses the canonical UTC Hijri result
HIJRI_TIME_ZONESRuntime list and TypeScript union for supported zones

Notes

  • format() is the highest-level entry point for server rendering
  • parseDate() returns a native Date
  • toDate() accepts the same Gregorian strings plus Date objects and timestamps

On this page