jalaali v0.1.1 Jalaali
Jalaali module helps converting gregorian dates to jalaali dates. Jalaali calendar is widely used in Persia and Afganistan.
This module helps you with converting erlang and/or elixir DateTime formats to Jalaali date (and vice versa) and checking for leap years
Summary
Functions
Checks if a Jalaali year is leap
Checks whether a Jalaali date is valid or not
This function determines if the Jalaali (persian) year is leap(366-day long) or is the common year (365-days), and finds the day in March (Gregorian calendar) of the first day of the Jalaali year (jy)
Number of days in a given month in a Jalaali year
Converts and elixir Date or DateTime from Gregorian to Jalaali in elixir Date or DateTime format
Converts and elixir Date or DateTime from Gregorian to Jalaali in elixir Date or DateTime format
Functions
Checks if a Jalaali year is leap
Parameters
- jy: Jalaali Year (-61 to 3177)
Examples
iex> Jalaali.is_leap_jalaali_year(1395) true
iex> Jalaali.is_leap_jalaali_year(1396) false
iex> Jalaali.is_leap_jalaali_year(1394) false
Checks whether a Jalaali date is valid or not.
Parameters
- arg1: is a tuple in shape of {jalaali_year, jalaali_month, jalaali_day}
Examples
iex> Jalaali.is_valid_jalaali_date {1395, 9, 27} true
iex> Jalaali.is_valid_jalaali_date {1395, 91, 27} false
This function determines if the Jalaali (persian) year is leap(366-day long) or is the common year (365-days), and finds the day in March (Gregorian calendar) of the first day of the Jalaali year (jy).
Parameters
- jy: Jalaali Year (-61 to 3177)
Number of days in a given month in a Jalaali year.
Examples
iex> Jalaali.jalaali_month_length(1395, 11) 30
iex> Jalaali.jalaali_month_length(1395, 6) 31
iex> Jalaali.jalaali_month_length(1394, 12) 29
iex> Jalaali.jalaali_month_length(1395, 12) 30
to_gregorian(Tuple.t) :: Tuple.t
to_gregorian(Tuple.t) :: Tuple.t
to_gregorian(DateTime.t | Date.t) :: DateTime.t | Date.t
Converts and elixir Date or DateTime from Gregorian to Jalaali in elixir Date or DateTime format
Parameters
- ex_dt: Date or DateTime to convert
Exmaples
iex> Jalaali.to_gregorian ~D[1395-09-27] ~D[2016-12-17]
to_jalaali(Tuple.t) :: Tuple.t
to_jalaali(Tuple.t) :: Tuple.t
to_jalaali(DateTime.t | Date.t) :: DateTime.t | Date.t
Converts and elixir Date or DateTime from Gregorian to Jalaali in elixir Date or DateTime format
Parameters
- ex_dt: Date or DateTime to convert
Exmaples
iex> Jalaali.to_jalaali ~D[2016-12-17] ~D[1395-09-27]