Documentation / jalali-js
jalali-js
The Jalali (Persian, Shamsi) to Gregorian conversion core. TypeScript-native, zero runtime dependencies, framework-agnostic.
sh
npm install jalali-jsts
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
- CalendarDate
- CalendarDateFields
- CalendarDateTime
- CalendarEngine
- CalendarGridDay
- CreateDateCalendarOptions
- CreateDateTimeCalendarOptions
- CreateZonedDateTimeCalendarOptions
- DateCalendar
- DateTimeCalendar
- NativeCalendarObject
- SelectionRules
- TimeOfDay
- WallClockFields
- ZonedCalendarDateTime
- ZonedDateTimeCalendar
Type Aliases
- AnyCalendarDate
- Calendar
- CalendarSystem
- CreateCalendarOptions
- DateFieldsWithSystem
- DiffUnit
- PeriodUnit
- Precision
- StorageValue
- ValueFormat
Variables
Functions
- addDays
- addMonths
- addYears
- buildCalendarGrid
- compareDates
- createCalendar
- dayOfWeek
- diffDates
- endOf
- fromGregorian
- getCalendarEngine
- getOffsetMinutes
- instantToZonedFields
- isAfter
- isBefore
- isBetween
- isDateSelectable
- isRangeSelectable
- isSameDay
- isToday
- listHours
- listMinutes
- nextMonth
- previousMonth
- resolveTimeZone
- snapMinute
- startOf
- timeOfDay
- toGregorian
- toStorageValue
- withTime
- zonedWallClockToInstant