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 type | Example |
|---|---|
| ISO date | 2026-03-31 |
| ISO timestamp | 2026-03-31T15:30:00Z |
| Gregorian text | 31 March 2026 |
| Bangla calendar text | 17 Chaitra 1432 |
| Legacy Bangla month names | Boishakh, 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
| Input | Result |
|---|---|
| Valid date string | A JavaScript Date |
| Bangla calendar string | A normalized Date when calendar: "bangla" is provided |
| Invalid input | An 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.