Tarikh
Reference

TypeScript

Public Tarikh types and compile-time contracts for the core API and React entry point.

Start Here

Use this page when you want to know which types to import before wiring the API.

Public Types

import type {
  BanglaCalendarDate,
  BanglaCalendarDateLocalized,
  BanglaCalendarFormatOptions,
  BanglaCalendarOptions,
  BanglaCalendarResult,
  BanglaCalendarDayFormat,
  BanglaCalendarDaySpokenVariant,
  BanglaDayFormatOptions,
  DateFormatOptions,
  DateInput,
  DateParseDetailedResult,
  DateParseFailureReason,
  DateParseOptions,
  FormatMode,
  FormatOptions,
  HijriCalendarDate,
  HijriCalendarDateLocalized,
  HijriCalendarFormatOptions,
  HijriCalendarOptions,
  HijriCalendarResult,
  HijriCalendarSystem,
  HijriTimeZone,
  HybridDateFormatOptions,
  Language,
  Locale,
  MonthFormat,
  RelativeTimeOptions,
  RelativeTimeStyle,
  StandardFormatPreset,
  TimeFormat,
  WeekdayFormat,
  YearFormat
} from "@coreify/tarikh";

import type { TarikhProps } from "@coreify/tarikh/react";
import type {
  BanglaDateProps,
  HijriDateProps,
  RelativeTimeProps
} from "@coreify/tarikh/react";

Key Contracts

TypePurpose
FormatOptionsMain formatting contract for format()
FormatModeThe supported standard, bangla, hijri, and hybrid modes
StandardFormatPresetPreset shortcuts like date, dateTime, and isoLike
DateInputAccepted input shape for core APIs
RelativeTimeOptionsOptions for fromNow(), including baseDate, style, and threshold
DateParseOptionsParser controls, including calendar: "bangla" and strict
DateParseDetailedResultStructured parse success and failure result
HijriTimeZoneThe supported Hijri timezone union
HijriCalendarSystemThe supported Hijri calculation backends

Locale-Aware Structured Results

import type {
  BanglaCalendarResult,
  HijriCalendarResult,
  Locale,
} from "@coreify/tarikh";

type BanglaEnglish = BanglaCalendarResult<"en-BD">;
// -> numeric fields

type BanglaBangla = BanglaCalendarResult<"bn-BD">;
// -> localized string fields

type DynamicLocaleResult = HijriCalendarResult<Locale>;
// -> safe union of both shapes

React Types

TypePurpose
TarikhPropsProps for the main React <Tarikh /> component
BanglaDatePropsProps for Tarikh.Bangla
HijriDatePropsProps for Tarikh.Hijri
RelativeTimePropsProps for Tarikh.Relative, including relativeStyle

Compile-Time Rules

RuleBehavior
pattern formattingDisallows mode in TypeScript
mode: "standard"Uses DateFormatOptions
mode: "bangla"Uses Bangla calendar options
mode: "hijri"Uses Hijri calendar options
mode: "hybrid"Uses hybrid date formatting options
locale: "bn-BD"Narrows structured calendar results to localized strings
locale: LocaleProduces a safe union result

These types are designed so invalid format() combinations fail at compile time before they reach runtime.

On this page