Tarikh
Utilities

Relative Time

Show labels like yesterday, tomorrow, today, and in 3 days with Bangla support.

Start Here

Use relative time when you want a human-friendly label instead of a fixed date.

Quick Rule

If the exact calendar date does not matter to the user, relative time is usually easier to read.

Common Outputs

CaseWhat it feels like
Past date1 day ago or ১ দিন আগে
Current daytoday when numeric: "auto" is enabled
Future datetomorrow or in 1 day depending on options
Localized outputUse locale: "bn-BD" for Bangla wording

Example

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

fromNow(new Date(Date.now() - 86400000));
// -> "1 day ago"

fromNow(new Date(Date.now() - 86400000), { locale: "bn-BD" });
// -> "১ দিন আগে"

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

fromNow(new Date(Date.now() + 86400000), {
  locale: "bn-BD",
  numeric: "auto"
});
// -> "আগামীকাল"

Good Fit

Use this for feeds, reminders, notifications, and timelines where relative wording reads better than a full date.

On this page