Julian (Calendars v0.2.4) View Source
The Julian
calendar module.
Link to this section Summary
Functions
Adds the number of days
to a fixed day or Julian date.
Adds the number of weeks
to a fixed day or Julian date
.
Adds the number of years
to a fixed year or Julian date.
Returns the fixed date of Easter (Orthodox) Alt
of the
Julian calendar in the given gregorian_year
or []
,
if there is no such holiday in that year.
Returns the month april
of the Julian
calendar.
Returns a fixed day or Julian date as a Julian date.
Returns a fixed day or Julian date as a fixed day.
Returns a fixed day or Julian date either as a fixed day or a Julian date.
Returns the month august
of the Julian
calendar.
Compares two Julian dates and returns...
Returns a Julian date from its fields year, month, day
.
Returns the difference (= number of days) between two Julian dates.
Returns the day
field of a Julian date.
Returns the ordinal day number of a fixed day or Julian date in the corresponding month.
Returns the ordinal day number of a fixed day or Julian date in the corresponding week.
Returns the ordinal day number of the fixed day or Julian date in the equivalent Julian year.
Returns the number of days in the month of a fixed day or Julian date.
Returns the number of days in the month given by the Julian year
and month
.
Returns the number of days in a week of the Julian calendar.
Returns the number of days in the Julian year.
Returns the number of days remaing in the month after a fixed day or Julian date.
Returns the number of days remaing after a fixed day or a Julian date in the equivalent Julian year.
Returns the month december
of the Julian
calendar.
Returns the fixed date of Christmas (Orthodox)
of the
Julian calendar in the given gregorian_year
or []
,
if there is no such holiday in that year.
Returns the last day of the month given by a fixed day or Julian date.
Returns the last day of the month given by the Julian year
and month
.
Returns the end of the week of the fixed day or Julian date.
Returns the last day of the Julian year
given by a fixed day
or a Julian date.
Returns the epoch of the Julian calendar.
Returns true if Julian date1
is equal Julian date2
, otherwise false.
Returns the month february
of the Julian
calendar.
Returns the name of the field atom in a Julian date at field_index
.
Returns a list of the field atoms (names) of a Julian date.
Returns the number of fields in a Julian date
Returns the index (= position) of the field_atom
in a Julian date.
Returns the weekday friday
of the Julian
calendar.
Converts the other_date
of the other_calendar
into the equivalent date of the Julian calendar.
Converts a fixed day to a Julian
date.
Converts a Julian Day into the equivalent Julian date.
Converts a RataDie date into the equivalent Julian date.
Converts a Unix date into the equivalent Julian date.
Returns true if Julian date1
is greater (= later) than or equal Julian date2
, otherwise false.
Returns true if Julian date1
is greater (= later) than Julian date2
, otherwise false.
Returns a list of the holidays of the Julian calendar.
Returns the month january
of the Julian
calendar.
Returns the month july
of the Julian
calendar.
Returns the month june
of the Julian
calendar.
Returns the internal keyword of the Julian calendar.
Returns true if Julian date1
is smaller (= earlier) than or equal Julian date2
, otherwise false.
Returns true
if the Julian year
is a leap year, otherwise false
.
Returns true if Julian date1
is smaller (= earlier) than Julian date2
, otherwise false.
Returns the month march
of the Julian
calendar.
Returns the month may
of the Julian
calendar.
Returns the average length of a Julian year.
Returns the module of the Julian calendar.
Returns the weekday monday
of the Julian
calendar.
Returns the month
field of a Julian date.
Returns a list of the months of the Julian calendar.
Returns the number of months in the Julian year
.
Returns the internal name of the Julian calendar.
Returns the month november
of the Julian
calendar.
Returns the month october
of the Julian
calendar.
Returns the fixed date of Easter (Orthodox)
of the
Julian calendar in the given gregorian_year
or []
,
if there is no such holiday in that year.
Returns the distance between two Julian dates as a range of fixed days.
Returns the weekday saturday
of the Julian
calendar.
Returns the month september
of the Julian
calendar.
Returns the first official use of the Julian calendar.
Returns the start of the day in the Julian calendar.
Returns the first day of the month given by a fixed day or Julian date.
Returns the first day of the month given by the Julian year
and month
.
Returns the start of the week of the fixed day or Julian date.
Returns the first day of the Julian year
given by a fixed day or a Julian date.
Returns the weekday sunday
of the Julian
calendar.
Returns the weekday thursday
of the Julian
calendar.
Converts a Julian date
into the equivalent date
of the other_calendar
.
Converts a Julian date tuple into a fixed day.
Converts a Julian date given by year, month, day
into a fixed day.
Converts a Julian date into the equivalent Julian Day.
Converts a Julian date given by year, month, day
into the equivalent Julian Day.
Converts a Julian date into the equivalent RataDie date.
Converts a Julian date given by year, month, day
into the equivalent RataDie date.
Converts a Julian date into the equivalent Unix date.
Converts a Julian date given by year, month, day
into the equivalent Unix date.
Returns the current date either as a fixed day or a Julian date.
Returns the weekday tuesday
of the Julian
calendar.
Returns the weekday wednesday
of the Julian
calendar.
Returns the weekday of a fixed day or a Julian date.
Returns a list of the weekdays of the Julian calendar.
Returns the year
field of a Julian date.
Link to this section Types
Specs
fixed() :: integer()
Specs
julian_date() :: {julian_year(), julian_month(), julian_day()}
Specs
julian_day() :: 1..31
Specs
julian_month() :: 1..12
Specs
julian_year() :: integer()
Specs
t() :: julian_date()
Link to this section Functions
Specs
add_days(fixed() | julian_date(), integer(), :fixed | :date) :: fixed() | julian_date()
Adds the number of days
to a fixed day or Julian date.
If days
is negative, the days will be subtracted.
The type
parameter determines the type of the returned value:
:fixed
returns a fixed day (default),:date
returns a Julian date.
Examples
iex>Elixir.Julian.add_days(730739, 100)
730839
iex>Elixir.Julian.add_days(730739, -100)
730639
iex>Elixir.Julian.add_days(730739, 100, :fixed)
730839
iex>Elixir.Julian.add_days(730739, -100, :fixed)
730639
iex>Elixir.Julian.add_days(730739, 100, :date)
{2001, 12, 7}
iex>Elixir.Julian.add_days(730739, -100, :date)
{2001, 5, 21}
iex>Elixir.Julian.add_days({2001, 8, 29}, 100)
730839
iex>Elixir.Julian.add_days({2001, 8, 29}, -100)
730639
iex>Elixir.Julian.add_days({2001, 8, 29}, 100, :fixed)
730839
iex>Elixir.Julian.add_days({2001, 8, 29}, -100, :fixed)
730639
iex>Elixir.Julian.add_days({2001, 8, 29}, 100, :date)
{2001, 12, 7}
iex>Elixir.Julian.add_days({2001, 8, 29}, -100, :date)
{2001, 5, 21}
Specs
add_weeks(fixed() | julian_date(), integer(), :fixed | :date) :: fixed() | julian_date()
Adds the number of weeks
to a fixed day or Julian date
.
If weeks
is negative, the weeks will be subtracted.
The type
parameter determines the type of the returned value:
:fixed
returns a fixed day (default),:date
returns a Julian date.
Examples
iex>Elixir.Julian.add_weeks(730739, 3)
730760
iex>Elixir.Julian.add_weeks(730739, -3)
730718
iex>Elixir.Julian.add_weeks(730739, 3, :fixed)
730760
iex>Elixir.Julian.add_weeks(730739, -3, :fixed)
730718
iex>Elixir.Julian.add_weeks(730739, 3, :date)
{2001, 9, 19}
iex>Elixir.Julian.add_weeks(730739, -3, :date)
{2001, 8, 8}
iex>Elixir.Julian.add_weeks({2001, 8, 29}, 3)
730760
iex>Elixir.Julian.add_weeks({2001, 8, 29}, -3)
730718
iex>Elixir.Julian.add_weeks({2001, 8, 29}, 3, :fixed)
730760
iex>Elixir.Julian.add_weeks({2001, 8, 29}, -3, :fixed)
730718
iex>Elixir.Julian.add_weeks({2001, 8, 29}, 3, :date)
{2001, 9, 19}
iex>Elixir.Julian.add_weeks({2001, 8, 29}, -3, :date)
{2001, 8, 8}
Specs
add_years(fixed() | julian_date(), integer(), :fixed | :date) :: fixed() | julian_date()
Adds the number of years
to a fixed year or Julian date.
Because of the different lengths of years the result is calculated using the average length of a year; so the result will not always have the same day of the month as the base date.
If years
is negative, the years will be subtracted.
The type
parameter determines the type of the returned value:
:fixed
returns a fixed day (default),:date
returns a Julian date.
Examples
iex>Elixir.Julian.add_years(730739, 3)
731834
iex>Elixir.Julian.add_years(730739, -3)
729643
iex>Elixir.Julian.add_years(730739, 3, :fixed)
731834
iex>Elixir.Julian.add_years(730739, -3, :fixed)
729643
iex>Elixir.Julian.add_years(730739, 3, :date)
{2004, 8, 28}
iex>Elixir.Julian.add_years(730739, -3, :date)
{1998, 8, 29}
iex>Elixir.Julian.add_years({2001, 8, 29}, 3)
731834
iex>Elixir.Julian.add_years({2001, 8, 29}, -3)
729643
iex>Elixir.Julian.add_years({2001, 8, 29}, 3, :fixed)
731834
iex>Elixir.Julian.add_years({2001, 8, 29}, -3, :fixed)
729643
iex>Elixir.Julian.add_years({2001, 8, 29}, 3, :date)
{2004, 8, 28}
iex>Elixir.Julian.add_years({2001, 8, 29}, -3, :date)
{1998, 8, 29}
Specs
alt_orthodox_easter(Gregorian.gregorian_year()) :: fixed() | julian_date()
Returns the fixed date of Easter (Orthodox) Alt
of the
Julian calendar in the given gregorian_year
or []
,
if there is no such holiday in that year.
The type
parameter determines the type of the returned value:
:fixed
returns a fixed day (default),:date
returns a Julian date.
Example
iex>Elixir.Julian.alt_orthodox_easter(2001)
{2001, 4, 15}
Specs
april(:integer | :name) :: integer()
Returns the month april
of the Julian
calendar.
The type
parameter determines the type of the returned month:
:integer
returns the number of the month (default),:name
returns the name of the month.
Examples
iex>Elixir.Julian.april()
4
iex>Elixir.Julian.april(:integer)
4
iex>Elixir.Julian.april(:name)
"April"
Specs
as_date(fixed() | julian_date()) :: julian_date()
Returns a fixed day or Julian date as a Julian date.
This is a convenience function to simplify certain function calls.
Examples
iex>Elixir.Julian.as_date(730739)
{2001, 8, 29}
iex>Elixir.Julian.as_date({2001, 8, 29})
{2001, 8, 29}
Specs
as_fixed(fixed() | julian_date()) :: fixed()
Returns a fixed day or Julian date as a fixed day.
This is a convenience function to simplify certain function calls.
Examples
iex>Elixir.Julian.as_fixed(730739)
730739
iex>Elixir.Julian.as_fixed({2001, 8, 29})
730739
Specs
as_type(fixed() | julian_date(), :fixed | :date) :: fixed() | julian_date()
Returns a fixed day or Julian date either as a fixed day or a Julian date.
The type
parameter determines the type of the returned value:
:fixed
returns a fixed day (default),:date
returns a Julian date.
Examples
iex>Elixir.Julian.as_type(730739)
730739
iex>Elixir.Julian.as_type(730739, :fixed)
730739
iex>Elixir.Julian.as_type(730739, :date)
{2001, 8, 29}
iex>Elixir.Julian.as_type({2001, 8, 29})
730739
iex>Elixir.Julian.as_type({2001, 8, 29}, :fixed)
730739
iex>Elixir.Julian.as_type({2001, 8, 29}, :date)
{2001, 8, 29}
Specs
august(:integer | :name) :: integer()
Returns the month august
of the Julian
calendar.
The type
parameter determines the type of the returned month:
:integer
returns the number of the month (default),:name
returns the name of the month.
Examples
iex>Elixir.Julian.august()
8
iex>Elixir.Julian.august(:integer)
8
iex>Elixir.Julian.august(:name)
"August"
Specs
compare(julian_date(), julian_date()) :: :lt | :eq | :gt
Compares two Julian dates and returns...
:lt
ifdate1
is smaller (= earlier) thandate2
,:eq
ifdate1
is equaldate2
,:gt
ifdate1
is larger (= later) thandate2
.
Examples
iex>Elixir.Julian.compare({2001, 8, 29}, {2001, 8, 29})
:eq
iex>Elixir.Julian.compare({2001, 8, 29}, {2001, 12, 7})
:lt
iex>Elixir.Julian.compare({2001, 12, 7}, {2001, 8, 29})
:gt
Specs
date(julian_year(), julian_month(), julian_day()) :: t()
Returns a Julian date from its fields year, month, day
.
Example
iex>Elixir.Julian.date(2001, 8, 29)
{2001, 8, 29}
Specs
date_diff(fixed() | julian_date(), fixed() | julian_date()) :: integer()
Returns the difference (= number of days) between two Julian dates.
The dates can be given as fixed days or Julian dates in arbitrary
combination. The difference is calculated by date2 - date1
.
If cal_date2
is larger (= later) than cal_date1
the result is positive.
If cal_date2
is smaller (= earlier) than cal_date1
the result is negative.
Examples
iex>Elixir.Julian.date_diff(730739, 730839)
100
iex>Elixir.Julian.date_diff(730839, 730739)
-100
iex>Elixir.Julian.date_diff({2001, 8, 29}, {2001, 12, 7})
100
iex>Elixir.Julian.date_diff({2001, 12, 7}, {2001, 8, 29})
-100
iex>Elixir.Julian.date_diff(730739, {2001, 12, 7})
100
iex>Elixir.Julian.date_diff({2001, 8, 29}, 730839)
100
Specs
day(fixed() | julian_date(), :atom | :index | :name | :value) :: :atom | integer() | String.t() | number()
Returns the day
field of a Julian date.
The type
parameter determines the type of the returned day:
:atom
returns the internal name of day,:index
returns the position of the day field within the date,:name
returns the common name of the day,:value
returns the value of the day (default).
Examples
iex>Elixir.Julian.day(730739)
29
iex>Elixir.Julian.day(730739, :atom)
:day
iex>Elixir.Julian.day(730739, :index)
2
iex>Elixir.Julian.day(730739, :name)
"Day"
iex>Elixir.Julian.day(730739, :value)
29
iex>Elixir.Julian.day({2001, 8, 29})
29
iex>Elixir.Julian.day({2001, 8, 29}, :atom)
:day
iex>Elixir.Julian.day({2001, 8, 29}, :index)
2
iex>Elixir.Julian.day({2001, 8, 29}, :name)
"Day"
iex>Elixir.Julian.day({2001, 8, 29}, :value)
29
Specs
day_of_month(fixed() | julian_date()) :: integer()
Returns the ordinal day number of a fixed day or Julian date in the corresponding month.
Examples
iex>Elixir.Julian.day_of_month(730739)
29
iex>Elixir.Julian.day_of_month({2001, 8, 29})
29
Specs
day_of_week(fixed() | julian_date()) :: integer()
Returns the ordinal day number of a fixed day or Julian date in the corresponding week.
Examples
iex>Elixir.Julian.day_of_week(730739)
2
iex>Elixir.Julian.day_of_week({2001, 8, 29})
2
Specs
day_of_year(fixed() | julian_date()) :: integer()
Returns the ordinal day number of the fixed day or Julian date in the equivalent Julian year.
Examples
iex>Elixir.Julian.day_of_year(730739)
241
iex>Elixir.Julian.day_of_year({2001, 8, 29})
241
Specs
days_in_month(fixed() | julian_date()) :: integer()
Returns the number of days in the month of a fixed day or Julian date.
Examples
iex>Elixir.Julian.days_in_month(730739)
31
iex>Elixir.Julian.days_in_month({2001, 8, 29})
31
Specs
days_in_month(julian_year(), julian_month()) :: integer()
Returns the number of days in the month given by the Julian year
and month
.
Example
iex>Elixir.Julian.days_in_month(2001, 8)
31
Specs
days_in_week() :: integer()
Returns the number of days in a week of the Julian calendar.
Example
iex>Elixir.Julian.days_in_week()
7
Specs
days_in_year(julian_year()) :: integer()
Returns the number of days in the Julian year.
Examples
iex>Elixir.Julian.days_in_year(2000)
366
iex>Elixir.Julian.days_in_year(2001)
365
Specs
days_remaining_in_month(fixed() | julian_date()) :: integer()
Returns the number of days remaing in the month after a fixed day or Julian date.
Examples
iex>Elixir.Julian.days_remaining_in_month(730739)
2
iex>Elixir.Julian.days_remaining_in_month({2001, 8, 29})
2
Specs
days_remaining_in_year(fixed() | julian_date()) :: integer()
Returns the number of days remaing after a fixed day or a Julian date in the equivalent Julian year.
Examples
iex>Elixir.Julian.days_remaining_in_year(730739)
124
iex>Elixir.Julian.days_remaining_in_year({2001, 8, 29})
124
Specs
december(:integer | :name) :: integer()
Returns the month december
of the Julian
calendar.
The type
parameter determines the type of the returned month:
:integer
returns the number of the month (default),:name
returns the name of the month.
Examples
iex>Elixir.Julian.december()
12
iex>Elixir.Julian.december(:integer)
12
iex>Elixir.Julian.december(:name)
"December"
Specs
eastern_orthodox_christmas(Gregorian.gregorian_year()) :: fixed() | julian_date()
Returns the fixed date of Christmas (Orthodox)
of the
Julian calendar in the given gregorian_year
or []
,
if there is no such holiday in that year.
The type
parameter determines the type of the returned value:
:fixed
returns a fixed day (default),:date
returns a Julian date.
Example
iex>Elixir.Julian.eastern_orthodox_christmas(2001)
{2001, 1, 7}
Specs
end_of_month(fixed() | julian_date(), :fixed | :date) :: fixed() | julian_date()
Returns the last day of the month given by a fixed day or Julian date.
The type
parameter determines the type of the returned value:
:fixed
returns a fixed day (default),:date
returns a Julian date.
Examples
iex>Elixir.Julian.end_of_month(730739)
730741
iex>Elixir.Julian.end_of_month(730739, :fixed)
730741
iex>Elixir.Julian.end_of_month(730739, :date)
{2001, 8, 31}
iex>Elixir.Julian.end_of_month({2001, 8, 31})
730741
iex>Elixir.Julian.end_of_month({2001, 8, 29}, :fixed)
730741
iex>Elixir.Julian.end_of_month({2001, 8, 29}, :date)
{2001, 8, 31}
Specs
end_of_month(julian_year(), julian_month(), :fixed | :date) :: fixed() | julian_date()
Returns the last day of the month given by the Julian year
and month
.
The type
parameter determines the type of the returned value:
:fixed
returns a fixed day (default),:date
returns a Julian date.
Examples
iex>Elixir.Julian.end_of_month(2001, 8, :fixed)
730741
iex>Elixir.Julian.end_of_month(2001, 8, :date)
{2001, 8, 31}
Specs
end_of_week(fixed() | julian_date(), :fixed | :date) :: fixed() | julian_date()
Returns the end of the week of the fixed day or Julian date.
The type
parameter determines the type of the returned value:
:fixed
returns a fixed day (default),:date
returns a Julian date.
Examples
iex>Elixir.Julian.end_of_week(730739)
730743
iex>Elixir.Julian.end_of_week(730739, :fixed)
730743
iex>Elixir.Julian.end_of_week(730739, :date)
{2001, 9, 2}
iex>Elixir.Julian.end_of_week({2001, 8, 29})
730743
iex>Elixir.Julian.end_of_week({2001, 8, 29}, :fixed)
730743
iex>Elixir.Julian.end_of_week({2001, 8, 29}, :date)
{2001, 9, 2}
Specs
end_of_year(fixed() | julian_date(), :fixed | :date) :: fixed() | julian_date()
Returns the last day of the Julian year
given by a fixed day
or a Julian date.
The type
parameter determines the type of the returned value:
:fixed
returns a fixed day (default),:date
returns a Julian date.
Examples
iex>Elixir.Julian.end_of_year(730739)
730863
iex>Elixir.Julian.end_of_year(730739, :fixed)
730863
iex>Elixir.Julian.end_of_year(730739, :date)
{2001, 12, 31}
Specs
epoch() :: number()
Returns the epoch of the Julian calendar.
Example
iex>Elixir.Julian.epoch()
-1
Specs
eq(julian_date(), julian_date()) :: boolean()
Returns true if Julian date1
is equal Julian date2
, otherwise false.
Examples
iex>Elixir.Julian.eq({2001, 8, 29}, {2001, 8, 29})
true
iex>Elixir.Julian.eq({2001, 8, 29}, {2001, 12, 7})
false
iex>Elixir.Julian.eq({2001, 12, 7}, {2001, 8, 29})
false
Specs
february(:integer | :name) :: integer()
Returns the month february
of the Julian
calendar.
The type
parameter determines the type of the returned month:
:integer
returns the number of the month (default),:name
returns the name of the month.
Examples
iex>Elixir.Julian.february()
2
iex>Elixir.Julian.february(:integer)
2
iex>Elixir.Julian.february(:name)
"February"
Specs
Returns the name of the field atom in a Julian date at field_index
.
Examples
iex>Elixir.Julian.field_atom(0)
:year
iex>Elixir.Julian.field_atom(1)
:month
iex>Elixir.Julian.field_atom(2)
:day
Specs
field_atoms() :: [atom()]
Returns a list of the field atoms (names) of a Julian date.
Example
iex>Elixir.Julian.field_atoms()
[:year, :month, :day]
Specs
field_count() :: integer()
Returns the number of fields in a Julian date
Example
iex>Elixir.Julian.field_count()
3
Specs
Returns the index (= position) of the field_atom
in a Julian date.
Examples
iex>Elixir.Julian.field_index(:year)
0
iex>Elixir.Julian.field_index(:month)
1
iex>Elixir.Julian.field_index(:day)
2
Specs
friday(:integer | :name) :: integer()
Returns the weekday friday
of the Julian
calendar.
The type
parameter determines the type of the returned weekday:
:integer
returns the number of the weekday (default),:name
returns the name of the weekday.
Examples
iex>Elixir.Julian.friday()
5
iex>Elixir.Julian.friday(:integer)
5
iex>Elixir.Julian.friday(:name)
"Friday"
Specs
Converts the other_date
of the other_calendar
into the equivalent date of the Julian calendar.
Example
iex>Elixir.Julian.from_date({2001, 9, 11}, Gregorian)
{2001, 8, 29}
Specs
from_fixed(fixed()) :: julian_date()
Converts a fixed day to a Julian
date.
Example
iex>Elixir.Julian.from_fixed(730739)
{2001, 8, 29}
Specs
from_jd(tuple() | number()) :: julian_date()
Converts a Julian Day into the equivalent Julian date.
The Julian Day can be given as a tuple or by a Julian day
.
Examples
iex>Elixir.Julian.from_jd({2452163.5})
{2001, 8, 29}
iex>Elixir.Julian.from_jd(2452163.5)
{2001, 8, 29}
Specs
from_rata_die(tuple() | integer()) :: julian_date()
Converts a RataDie date into the equivalent Julian date.
The RataDie date can be given as a tuple or by a RataDie rd
.
Examples
iex>Elixir.Julian.from_rata_die({730739})
{2001, 8, 29}
iex>Elixir.Julian.from_rata_die(730739)
{2001, 8, 29}
Specs
from_unix(tuple() | integer()) :: julian_date()
Converts a Unix date into the equivalent Julian date.
The Unix date can be given as a tuple or by Unix seconds
.
Examples
iex>Elixir.Julian.from_unix({1000166400})
{2001, 8, 29}
iex>Elixir.Julian.from_unix(1000166400)
{2001, 8, 29}
Specs
ge(julian_date(), julian_date()) :: boolean()
Returns true if Julian date1
is greater (= later) than or equal Julian date2
, otherwise false.
Examples
iex>Elixir.Julian.ge({2001, 8, 29}, {2001, 8, 29})
true
iex>Elixir.Julian.ge({2001, 8, 29}, {2001, 12, 7})
false
iex>Elixir.Julian.ge({2001, 12, 7}, {2001, 8, 29})
true
Specs
gt(julian_date(), julian_date()) :: boolean()
Returns true if Julian date1
is greater (= later) than Julian date2
, otherwise false.
Examples
iex>Elixir.Julian.gt({2001, 8, 29}, {2001, 8, 29})
false
iex>Elixir.Julian.gt({2001, 8, 29}, {2001, 12, 7})
false
iex>Elixir.Julian.gt({2001, 12, 7}, {2001, 8, 29})
true
Returns a list of the holidays of the Julian calendar.
The type
parameter determines the type of the returned holidays:
:atom
returns the internal names of the holidays,:name
returns the common names of the holidays (default).
Examples
iex>Elixir.Julian.holidays()
["Christmas (Orthodox)", "Easter (Orthodox)", "Easter (Orthodox) Alt"]
iex>Elixir.Julian.holidays(:atom)
[:eastern_orthodox_christmas, :orthodox_easter, :alt_orthodox_easter]
iex>Elixir.Julian.holidays(:name)
["Christmas (Orthodox)", "Easter (Orthodox)", "Easter (Orthodox) Alt"]
Specs
january(:integer | :name) :: integer()
Returns the month january
of the Julian
calendar.
The type
parameter determines the type of the returned month:
:integer
returns the number of the month (default),:name
returns the name of the month.
Examples
iex>Elixir.Julian.january()
1
iex>Elixir.Julian.january(:integer)
1
iex>Elixir.Julian.january(:name)
"January"
Specs
july(:integer | :name) :: integer()
Returns the month july
of the Julian
calendar.
The type
parameter determines the type of the returned month:
:integer
returns the number of the month (default),:name
returns the name of the month.
Examples
iex>Elixir.Julian.july()
7
iex>Elixir.Julian.july(:integer)
7
iex>Elixir.Julian.july(:name)
"July"
Specs
june(:integer | :name) :: integer()
Returns the month june
of the Julian
calendar.
The type
parameter determines the type of the returned month:
:integer
returns the number of the month (default),:name
returns the name of the month.
Examples
iex>Elixir.Julian.june()
6
iex>Elixir.Julian.june(:integer)
6
iex>Elixir.Julian.june(:name)
"June"
Specs
keyword() :: atom()
Returns the internal keyword of the Julian calendar.
Example
iex>Elixir.Julian.keyword()
:julian
Specs
le(julian_date(), julian_date()) :: boolean()
Returns true if Julian date1
is smaller (= earlier) than or equal Julian date2
, otherwise false.
Examples
iex>Elixir.Julian.le({2001, 8, 29}, {2001, 8, 29})
true
iex>Elixir.Julian.le({2001, 8, 29}, {2001, 12, 7})
true
iex>Elixir.Julian.le({2001, 12, 7}, {2001, 8, 29})
false
Specs
leap_year?(julian_year()) :: boolean()
Returns true
if the Julian year
is a leap year, otherwise false
.
Examples
iex>Elixir.Julian.leap_year?(2000)
true
iex>Elixir.Julian.leap_year?(2001)
false
iex>Elixir.Julian.leap_year?(2002)
false
iex>Elixir.Julian.leap_year?(2003)
false
Specs
lt(julian_date(), julian_date()) :: boolean()
Returns true if Julian date1
is smaller (= earlier) than Julian date2
, otherwise false.
Examples
iex>Elixir.Julian.lt({2001, 8, 29}, {2001, 8, 29})
false
iex>Elixir.Julian.lt({2001, 8, 29}, {2001, 12, 7})
true
iex>Elixir.Julian.lt({2001, 12, 7}, {2001, 8, 29})
false
Specs
march(:integer | :name) :: integer()
Returns the month march
of the Julian
calendar.
The type
parameter determines the type of the returned month:
:integer
returns the number of the month (default),:name
returns the name of the month.
Examples
iex>Elixir.Julian.march()
3
iex>Elixir.Julian.march(:integer)
3
iex>Elixir.Julian.march(:name)
"March"
Specs
may(:integer | :name) :: integer()
Returns the month may
of the Julian
calendar.
The type
parameter determines the type of the returned month:
:integer
returns the number of the month (default),:name
returns the name of the month.
Examples
iex>Elixir.Julian.may()
5
iex>Elixir.Julian.may(:integer)
5
iex>Elixir.Julian.may(:name)
"May"
Specs
mean_year() :: number()
Returns the average length of a Julian year.
Example
iex>Elixir.Julian.mean_year()
365.25
Specs
module() :: module()
Returns the module of the Julian calendar.
Example
iex>Elixir.Julian.module()
Julian
Specs
monday(:integer | :name) :: integer()
Returns the weekday monday
of the Julian
calendar.
The type
parameter determines the type of the returned weekday:
:integer
returns the number of the weekday (default),:name
returns the name of the weekday.
Examples
iex>Elixir.Julian.monday()
1
iex>Elixir.Julian.monday(:integer)
1
iex>Elixir.Julian.monday(:name)
"Monday"
Specs
month(fixed() | julian_date(), :atom | :index | :name | :value) :: :atom | integer() | String.t() | number()
Returns the month
field of a Julian date.
The type
parameter determines the type of the returned month:
:atom
returns the internal name of month,:index
returns the position of the month field within the date,:name
returns the common name of the month,:value
returns the value of the month (default).
Examples
iex>Elixir.Julian.month(730739)
8
iex>Elixir.Julian.month(730739, :atom)
:month
iex>Elixir.Julian.month(730739, :index)
1
iex>Elixir.Julian.month(730739, :name)
"Month"
iex>Elixir.Julian.month(730739, :value)
8
iex>Elixir.Julian.month({2001, 8, 29})
8
iex>Elixir.Julian.month({2001, 8, 29}, :atom)
:month
iex>Elixir.Julian.month({2001, 8, 29}, :index)
1
iex>Elixir.Julian.month({2001, 8, 29}, :name)
"Month"
iex>Elixir.Julian.month({2001, 8, 29}, :value)
8
Specs
Returns a list of the months of the Julian calendar.
The type
parameter determines the type of the returned months:
:integer
returns the numbers of the months,:atom
returns the internal names of the months,:name
returns the common names of the months (default).
Examples
iex>Elixir.Julian.months()
["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
iex>Elixir.Julian.months(:integer)
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
iex>Elixir.Julian.months(:atom)
[:january, :february, :march, :april, :may, :june, :july, :august, :september, :october, :november, :december]
iex>Elixir.Julian.months(:name)
["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
Specs
months_in_year(julian_year()) :: integer()
Returns the number of months in the Julian year
.
Example
iex>Elixir.Julian.months_in_year(730739)
12
Specs
name() :: atom()
Returns the internal name of the Julian calendar.
Example
iex>Elixir.Julian.name()
"Julian"
Specs
november(:integer | :name) :: integer()
Returns the month november
of the Julian
calendar.
The type
parameter determines the type of the returned month:
:integer
returns the number of the month (default),:name
returns the name of the month.
Examples
iex>Elixir.Julian.november()
11
iex>Elixir.Julian.november(:integer)
11
iex>Elixir.Julian.november(:name)
"November"
Specs
october(:integer | :name) :: integer()
Returns the month october
of the Julian
calendar.
The type
parameter determines the type of the returned month:
:integer
returns the number of the month (default),:name
returns the name of the month.
Examples
iex>Elixir.Julian.october()
10
iex>Elixir.Julian.october(:integer)
10
iex>Elixir.Julian.october(:name)
"October"
Specs
orthodox_easter(Gregorian.gregorian_year()) :: fixed() | julian_date()
Returns the fixed date of Easter (Orthodox)
of the
Julian calendar in the given gregorian_year
or []
,
if there is no such holiday in that year.
The type
parameter determines the type of the returned value:
:fixed
returns a fixed day (default),:date
returns a Julian date.
Example
iex>Elixir.Julian.orthodox_easter(2001)
{2001, 4, 15}
Specs
range(julian_date(), julian_date()) :: integer()
Returns the distance between two Julian dates as a range of fixed days.
Example
iex>Elixir.Julian.range({2001, 8, 29}, {2001, 12, 7})
730739..730839
Specs
saturday(:integer | :name) :: integer()
Returns the weekday saturday
of the Julian
calendar.
The type
parameter determines the type of the returned weekday:
:integer
returns the number of the weekday (default),:name
returns the name of the weekday.
Examples
iex>Elixir.Julian.saturday()
6
iex>Elixir.Julian.saturday(:integer)
6
iex>Elixir.Julian.saturday(:name)
"Saturday"
Specs
september(:integer | :name) :: integer()
Returns the month september
of the Julian
calendar.
The type
parameter determines the type of the returned month:
:integer
returns the number of the month (default),:name
returns the name of the month.
Examples
iex>Elixir.Julian.september()
9
iex>Elixir.Julian.september(:integer)
9
iex>Elixir.Julian.september(:name)
"September"
Specs
start_of_calendar(:fixed | :date) :: term()
Returns the first official use of the Julian calendar.
The type
parameter determines the type of the returned value:
:fixed
returns a fixed day (default),:date
returns a Julian date.
Examples
iex>Elixir.Julian.start_of_calendar()
-16803
iex>Elixir.Julian.start_of_calendar(:fixed)
-16803
iex>Elixir.Julian.start_of_calendar(:date)
{-46, 1, 1}
Specs
start_of_day() :: :midnight | :sunset | :sunrise | :noon
Returns the start of the day in the Julian calendar.
Possible return values are:
:midnight
,:noon
,:sunrise
,:sunset
,
Example
iex>Elixir.Julian.start_of_day()
:midnight
Specs
start_of_month(fixed() | julian_date(), :fixed | :date) :: fixed() | julian_date()
Returns the first day of the month given by a fixed day or Julian date.
The type
parameter determines the type of the returned value:
:fixed
returns a fixed day (default),:date
returns a Julian date.
Examples
iex>Elixir.Julian.start_of_month(730711)
730711
iex>Elixir.Julian.start_of_month(730711, :fixed)
730711
iex>Elixir.Julian.start_of_month(730711, :date)
{2001, 8, 1}
iex>Elixir.Julian.start_of_month({2001, 8, 1})
730711
iex>Elixir.Julian.start_of_month({2001, 8, 1}, :fixed)
730711
iex>Elixir.Julian.start_of_month({2001, 8, 1}, :date)
{2001, 8, 1}
Specs
start_of_month(julian_year(), julian_month(), :fixed | :date) :: fixed() | julian_date()
Returns the first day of the month given by the Julian year
and month
.
The type
parameter determines the type of the returned value:
:fixed
returns a fixed day (default),:date
returns a Julian date.
Examples
iex>Elixir.Julian.start_of_month(2001, 8, :fixed)
730711
iex>Elixir.Julian.start_of_month(2001, 8, :date)
{2001, 8, 1}
Specs
start_of_week(fixed() | julian_date(), :fixed | :date) :: fixed() | julian_date()
Returns the start of the week of the fixed day or Julian date.
The type
parameter determines the type of the returned value:
:fixed
returns a fixed day (default),:date
returns a Julian date.
Examples
iex>Elixir.Julian.start_of_week(730739)
730737
iex>Elixir.Julian.start_of_week(730739, :fixed)
730737
iex>Elixir.Julian.start_of_week(730739, :date)
{2001, 8, 27}
iex>Elixir.Julian.start_of_week({2001, 8, 29})
730737
iex>Elixir.Julian.start_of_week({2001, 8, 29}, :fixed)
730737
iex>Elixir.Julian.start_of_week({2001, 8, 29}, :date)
{2001, 8, 27}
Specs
start_of_year(fixed() | julian_date(), :fixed | :date) :: fixed() | julian_date()
Returns the first day of the Julian year
given by a fixed day or a Julian date.
The type
parameter determines the type of the returned value:
:fixed
returns a fixed day (default),:date
returns a Julian date.
Examples
iex>Elixir.Julian.start_of_year(730739)
730499
iex>Elixir.Julian.start_of_year(730739, :fixed)
730499
iex>Elixir.Julian.start_of_year(730739, :date)
{2001, 1, 1}
Specs
sunday(:integer | :name) :: integer()
Returns the weekday sunday
of the Julian
calendar.
The type
parameter determines the type of the returned weekday:
:integer
returns the number of the weekday (default),:name
returns the name of the weekday.
Examples
iex>Elixir.Julian.sunday()
0
iex>Elixir.Julian.sunday(:integer)
0
iex>Elixir.Julian.sunday(:name)
"Sunday"
Specs
thursday(:integer | :name) :: integer()
Returns the weekday thursday
of the Julian
calendar.
The type
parameter determines the type of the returned weekday:
:integer
returns the number of the weekday (default),:name
returns the name of the weekday.
Examples
iex>Elixir.Julian.thursday()
4
iex>Elixir.Julian.thursday(:integer)
4
iex>Elixir.Julian.thursday(:name)
"Thursday"
Specs
to_date(julian_date(), module()) :: tuple()
Converts a Julian date
into the equivalent date
of the other_calendar
.
For the following example to work the Gregorian calendar must be available.
Example
iex>Elixir.Julian.to_date({2001, 8, 29}, Gregorian)
{2001, 9, 11}
Specs
to_fixed(julian_date()) :: fixed()
Converts a Julian date tuple into a fixed day.
Example
iex>Elixir.Julian.to_fixed({2001, 8, 29})
730739
Specs
to_fixed(julian_year(), julian_month(), julian_day()) :: fixed()
Converts a Julian date given by year, month, day
into a fixed day.
Example
iex>Elixir.Julian.to_fixed(2001, 8, 29)
730739
Specs
to_jd(julian_date()) :: {number()}
Converts a Julian date into the equivalent Julian Day.
Example
iex>Elixir.Julian.to_jd({2001, 8, 29})
{2452163.5}
Specs
to_jd(julian_year(), julian_month(), julian_day()) :: {number()}
Converts a Julian date given by year, month, day
into the equivalent Julian Day.
Example
iex>Elixir.Julian.to_jd(2001, 8, 29)
{2452163.5}
Specs
to_rata_die(julian_date()) :: {integer()}
Converts a Julian date into the equivalent RataDie date.
Example
iex>Elixir.Julian.to_rata_die({2001, 8, 29})
{730739}
Specs
to_rata_die(julian_year(), julian_month(), julian_day()) :: {integer()}
Converts a Julian date given by year, month, day
into the equivalent RataDie date.
Example
iex>Elixir.Julian.to_rata_die(2001, 8, 29)
{730739}
Specs
to_unix(julian_date()) :: {integer()}
Converts a Julian date into the equivalent Unix date.
Example
iex>Elixir.Julian.to_unix({2001, 8, 29})
{1000166400}
Specs
to_unix(julian_year(), julian_month(), julian_day()) :: {integer()}
Converts a Julian date given by year, month, day
into the equivalent Unix date.
Example
iex>Elixir.Julian.to_unix(2001, 8, 29)
{1000166400}
Specs
today(:fixed | :date) :: fixed() | julian_date()
Returns the current date either as a fixed day or a Julian date.
(This cannot be doctested, because today
is a moving target.)
The type
parameter determines the type of the returned value:
:fixed
returns a fixed day (default),:date
returns a Julian date.
Examples
Elixir.Julian.today()
730739
Elixir.Julian.today(:fixed)
730739
Elixir.Julian.today(:date)
{2001, 8, 29}
Specs
tuesday(:integer | :name) :: integer()
Returns the weekday tuesday
of the Julian
calendar.
The type
parameter determines the type of the returned weekday:
:integer
returns the number of the weekday (default),:name
returns the name of the weekday.
Examples
iex>Elixir.Julian.tuesday()
2
iex>Elixir.Julian.tuesday(:integer)
2
iex>Elixir.Julian.tuesday(:name)
"Tuesday"
Specs
wednesday(:integer | :name) :: integer()
Returns the weekday wednesday
of the Julian
calendar.
The type
parameter determines the type of the returned weekday:
:integer
returns the number of the weekday (default),:name
returns the name of the weekday.
Examples
iex>Elixir.Julian.wednesday()
3
iex>Elixir.Julian.wednesday(:integer)
3
iex>Elixir.Julian.wednesday(:name)
"Wednesday"
Specs
weekday(fixed() | julian_date(), :atom | :integer | :name) :: integer() | atom() | String.t()
Returns the weekday of a fixed day or a Julian date.
The type
parameter determines the type of the returned weekday:
:atom
returns the internal name of weekday,:integer
returns the number of the weekday (default),:name
returns the common name of the weekday.
Examples
iex>Elixir.Julian.weekday(730739)
2
iex>Elixir.Julian.weekday(730739, :integer)
2
iex>Elixir.Julian.weekday(730739, :atom)
:tuesday
iex>Elixir.Julian.weekday(730739, :name)
"Tuesday"
iex>Elixir.Julian.weekday({2001, 8, 29})
2
iex>Elixir.Julian.weekday({2001, 8, 29}, :integer)
2
iex>Elixir.Julian.weekday({2001, 8, 29}, :atom)
:tuesday
iex>Elixir.Julian.weekday({2001, 8, 29}, :name)
"Tuesday"
Returns a list of the weekdays of the Julian calendar.
The type
parameter determines the type of the returned weekdays:
:integer
returns the numbers of the weekdays,:atom
returns the internal names of the weekdays,:name
returns the common names of the weekdays (default).
Examples
iex>Elixir.Julian.weekdays()
["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
iex>Elixir.Julian.weekdays(:integer)
[0, 1, 2, 3, 4, 5, 6]
iex>Elixir.Julian.weekdays(:atom)
[:sunday, :monday, :tuesday, :wednesday, :thursday, :friday, :saturday]
iex>Elixir.Julian.weekdays(:name)
["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
Specs
year(fixed() | julian_date(), :atom | :index | :name | :value) :: :atom | integer() | String.t() | number()
Returns the year
field of a Julian date.
The type
parameter determines the type of the returned year:
:atom
returns the internal name of year,:index
returns the position of the year field within the date,:name
returns the common name of the year,:value
returns the value of the year (default).
Examples
iex>Elixir.Julian.year(730739)
2001
iex>Elixir.Julian.year(730739, :atom)
:year
iex>Elixir.Julian.year(730739, :index)
0
iex>Elixir.Julian.year(730739, :name)
"Year"
iex>Elixir.Julian.year(730739, :value)
2001
iex>Elixir.Julian.year({2001, 8, 29})
2001
iex>Elixir.Julian.year({2001, 8, 29}, :atom)
:year
iex>Elixir.Julian.year({2001, 8, 29}, :index)
0
iex>Elixir.Julian.year({2001, 8, 29}, :name)
"Year"
iex>Elixir.Julian.year({2001, 8, 29}, :value)
2001