Tarikh
Getting Started

Quick Start

Show your first date with Tarikh.

Try It Once

If you just want to see Tarikh working, start here.

import {
  format,
  fromNow,
  getDefaults,
  parseDateDetailed,
  setDefaults,
  toBanglaCalendar,
} from "@coreify/tarikh";

format("2026-03-31", { mode: "standard" });
// -> "31st Mar 2026"

format("2026-04-14", { mode: "bangla", locale: "bn-BD" });
// -> "১লা বৈশাখ ১৪৩৩ বঙ্গাব্দ"

format(new Date(2026, 2, 31, 15, 4, 9), {
  mode: "standard",
  preset: "dateTime",
});
// -> "31st Mar 2026, 15:04"

fromNow(new Date(Date.now() - 86400000), { numeric: "auto" });
// -> "yesterday"

fromNow("2026-03-31T10:00:00Z", {
  baseDate: "2026-03-31T12:00:00Z",
  style: "short",
});
// -> "2h ago"

toBanglaCalendar("2026-03-31", { locale: "bn-BD" });
// -> { day: "১৭", month: "চৈত্র", monthIndex: 12, year: "১৪৩২" }

parseDateDetailed("31 Mar 26", { strict: true });
// -> { success: false, reason: "strict_mismatch", ... }

setDefaults({ locale: "bn-BD", mode: "standard", month: "long" });
getDefaults();
// -> { locale: "bn-BD", mode: "standard", month: "long", timeZone: "Asia/Dhaka", hijriSystem: "islamic-umalqura" }

Pick the Right Result

If you want...Use this
A normal date labelformat(..., { mode: "standard" })
A Bangla calendar dateformat(..., { mode: "bangla" })
A Hijri dateformat(..., { mode: "hijri" })
A mixed English/Bangla dateformat(..., { mode: "hybrid" })
A relative labelfromNow()
Strict validation feedbackparseDateDetailed()
Reusable package-wide defaultssetDefaults() and getDefaults()
The calendar parts themselvestoBanglaCalendar() or toHijriCalendar()

Next Step

If you want to choose a specific style, go to Formatting.

On this page