Tarikh
Utilities

Parsing

Turn date strings into Date objects, including Bangla calendar text when you opt in.

Start Here

Use parsing when the user gives you a date string and you need a JavaScript Date back.

Quick Rule

If the input is text and the next step is date math or formatting, parse it first.

Supported Inputs

Input typeExample
ISO date2026-03-31
ISO timestamp2026-03-31T15:30:00Z
Gregorian text31 March 2026
Bangla calendar text17 Chaitra 1432
Legacy Bangla month namesBoishakh, Poush, Falgun, Asharh

Example

import { parseDate } from "@coreify/tarikh";

parseDate("৩১ মার্চ ২০২৬");
// -> Date object (March 31, 2026)

parseDate("17 Chaitra 1432", { calendar: "bangla" });
// -> Date object (March 31, 2026)

parseDate("2026-03-31T15:30:00Z");
// -> Date object (March 31, 2026, 3:30 PM UTC)

What It Returns

InputResult
Valid date stringA JavaScript Date
Bangla calendar stringA normalized Date when calendar: "bangla" is provided
Invalid inputAn invalid date result, which you should check before using

Good Fit

Use this when your app accepts user input, imports date text, or needs to normalize dates before formatting.

On this page