Dayoff.Calendar.Jalaali (Dayoff v0.2.1)

Copy Markdown View Source

The Jalaali (Persian) calendar, the arithmetic algorithm of jalaali-js (Behrooz Khosravi, after Borkowski) which the reference implementation uses. Valid for Jalaali years -61 to 3177.

Summary

Functions

The Jalaali date of a Gregorian date, as {year, month, day}.

The Gregorian date of a Jalaali date.

Functions

from_gregorian(date)

@spec from_gregorian(Date.t()) :: {integer(), 1..12, 1..31}

The Jalaali date of a Gregorian date, as {year, month, day}.

iex> Dayoff.Calendar.Jalaali.from_gregorian(~D[2026-01-01])
{1404, 10, 11}

to_gregorian(jalaali_year, month, day)

@spec to_gregorian(integer(), 1..12, 1..31) :: Date.t()

The Gregorian date of a Jalaali date.

iex> Dayoff.Calendar.Jalaali.to_gregorian(1405, 1, 1)
~D[2026-03-21]