Skip to content

Documentation / jalali-js

jalali-js

The Jalali (Persian, Shamsi) to Gregorian conversion core. TypeScript-native, zero runtime dependencies, framework-agnostic.

sh
npm install jalali-js
ts
import { createCalendar, toGregorian, fromGregorian } from 'jalali-js';

const jalali = createCalendar({ system: 'jalali' });
jalali.today(); // { year: 1403, month: 5, day: 15 }

toGregorian({ year: 1403, month: 5, day: 15 }, 'jalali'); // { year: 2024, month: 8, day: 5 }

Three precision tiers (CalendarDate, CalendarDateTime, ZonedCalendarDateTime, matching TC39 Temporal's own tiers), and a valueFormat option for opting a stored value into the Jalali calendar instead of the Gregorian default.

Guide and API reference · Examples · Playground

Part of the jalali-js toolkit: @jalali-js/react, @jalali-js/vue, and @jalali-js/web (plain Web Components, no framework required) build bindings on top of this package; @jalali-js/i18n and @jalali-js/nlp are separate, optional packages for display formatting and natural language parsing.

Used by

MIT licensed.

Interfaces

Type Aliases

Variables

Functions