jalaali v0.2.1 Jalaali View Source
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
Link to this section Summary
Functions
Converts days number to jalaali date
Checks if a Jalaali year is leap
This function is same as is_valid_jalaali_date?
and is only here
because i forgot to add question mark in jalaali <= 0.1.1
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 jalaali date to days number
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
Link to this section Functions
Converts days number to jalaali date
is_leap_jalaali_year(Integer.t) :: boolean
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
is_valid_jalaali_date(Tuple.t) :: boolean
This function is same as is_valid_jalaali_date?
and is only here
because i forgot to add question mark in jalaali <= 0.1.1
Please use is_valid_jalaali_date?
instead.
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
Converts jalaali date to days number
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]