AztecTonalpohualli (Calendars v0.2.4) View Source
The AztecTonalpohualli calendar module.
This is a cyclical calendar. So it is not possible to convert a 'date' of this calendar into a corresponding date of a monotonic or another cyclical calendar.
Link to this section Summary
Functions
Returns a fixed day or AztecTonalpohualli date as a AztecTonalpohualli date.
Returns a AztecTonalpohualli date from its fields tonal_number, tonal_name.
Returns the name of the field atom in a AztecTonalpohualli date at field_index.
Returns a list of the field atoms (names) of a AztecTonalpohualli date.
Returns the number of fields in a AztecTonalpohualli date
Returns the index (= position) of the field_atom in a AztecTonalpohualli date.
Converts the other_date of the other_calendar into the equivalent date of the AztecTonalpohualli calendar.
Converts a fixed day to a AztecTonalpohualli date.
Converts a Julian Day into the equivalent AztecTonalpohualli date.
Converts a RataDie date into the equivalent AztecTonalpohualli date.
Converts a Unix date into the equivalent AztecTonalpohualli date.
Returns the internal keyword of the AztecTonalpohualli calendar.
Returns the module of the AztecTonalpohualli calendar.
Returns the internal name of the AztecTonalpohualli calendar.
Returns the tonal_name field of a AztecTonalpohualli date.
Returns the tonal_number field of a AztecTonalpohualli date.
Link to this section Types
Specs
aztec_tonalpohualli_date() ::
{aztec_tonalpohualli_tonal_number(), aztec_tonalpohualli_tonal_name()}
Specs
aztec_tonalpohualli_tonal_name() :: 1..13
Specs
aztec_tonalpohualli_tonal_number() :: 1..20
Specs
fixed() :: integer()
Specs
t() :: aztec_tonalpohualli_date()
Link to this section Functions
Specs
as_date(fixed() | aztec_tonalpohualli_date()) :: aztec_tonalpohualli_date()
Returns a fixed day or AztecTonalpohualli date as a AztecTonalpohualli date.
This is a convenience function to simplify certain function calls.
Examples
iex>Elixir.AztecTonalpohualli.as_date(730739)
{6, 1}
iex>Elixir.AztecTonalpohualli.as_date({6, 1})
{6, 1} Specs
date(aztec_tonalpohualli_tonal_number(), aztec_tonalpohualli_tonal_name()) :: t()
Returns a AztecTonalpohualli date from its fields tonal_number, tonal_name.
Example
iex>Elixir.AztecTonalpohualli.date(6, 1)
{6, 1} Specs
Returns the name of the field atom in a AztecTonalpohualli date at field_index.
Examples
iex>Elixir.AztecTonalpohualli.field_atom(0)
:tonal_number
iex>Elixir.AztecTonalpohualli.field_atom(1)
:tonal_name Specs
field_atoms() :: [atom()]
Returns a list of the field atoms (names) of a AztecTonalpohualli date.
Example
iex>Elixir.AztecTonalpohualli.field_atoms()
[:tonal_number, :tonal_name] Specs
field_count() :: integer()
Returns the number of fields in a AztecTonalpohualli date
Example
iex>Elixir.AztecTonalpohualli.field_count()
2 Specs
Returns the index (= position) of the field_atom in a AztecTonalpohualli date.
Examples
iex>Elixir.AztecTonalpohualli.field_index(:tonal_number)
0
iex>Elixir.AztecTonalpohualli.field_index(:tonal_name)
1 Specs
from_date(tuple(), module()) :: aztec_tonalpohualli_date()
from_date(tuple(), module()) :: {:error, String.t()}
Converts the other_date of the other_calendar into the equivalent date of the AztecTonalpohualli calendar.
Example
iex>Elixir.AztecTonalpohualli.from_date({2001, 9, 11}, Gregorian)
{6, 1} Specs
from_fixed(fixed()) :: aztec_tonalpohualli_date()
Converts a fixed day to a AztecTonalpohualli date.
Example
iex>Elixir.AztecTonalpohualli.from_fixed(730739)
{6, 1} Specs
from_jd(tuple() | number()) :: aztec_tonalpohualli_date()
Converts a Julian Day into the equivalent AztecTonalpohualli date.
The Julian Day can be given as a tuple or by a Julian day.
Examples
iex>Elixir.AztecTonalpohualli.from_jd({2452163.5})
{6, 1}
iex>Elixir.AztecTonalpohualli.from_jd(2452163.5)
{6, 1} Specs
from_rata_die(tuple() | integer()) :: aztec_tonalpohualli_date()
Converts a RataDie date into the equivalent AztecTonalpohualli date.
The RataDie date can be given as a tuple or by a RataDie rd.
Examples
iex>Elixir.AztecTonalpohualli.from_rata_die({730739})
{6, 1}
iex>Elixir.AztecTonalpohualli.from_rata_die(730739)
{6, 1} Specs
from_unix(tuple() | integer()) :: aztec_tonalpohualli_date()
Converts a Unix date into the equivalent AztecTonalpohualli date.
The Unix date can be given as a tuple or by Unix seconds.
Examples
iex>Elixir.AztecTonalpohualli.from_unix({1000166400})
{6, 1}
iex>Elixir.AztecTonalpohualli.from_unix(1000166400)
{6, 1} Specs
keyword() :: atom()
Returns the internal keyword of the AztecTonalpohualli calendar.
Example
iex>Elixir.AztecTonalpohualli.keyword()
:aztec_tonalpohualli Specs
module() :: module()
Returns the module of the AztecTonalpohualli calendar.
Example
iex>Elixir.AztecTonalpohualli.module()
AztecTonalpohualli Specs
name() :: atom()
Returns the internal name of the AztecTonalpohualli calendar.
Example
iex>Elixir.AztecTonalpohualli.name()
"AztecTonalpohualli" Specs
tonal_name( fixed() | aztec_tonalpohualli_date(), :atom | :index | :name | :value ) :: :atom | integer() | String.t() | number()
Returns the tonal_name field of a AztecTonalpohualli date.
The type parameter determines the type of the returned tonal_name:
:atomreturns the internal name of tonal_name,:indexreturns the position of the tonal_name field within the date,:namereturns the common name of the tonal_name,:valuereturns the value of the tonal_name (default).
Examples
iex>Elixir.AztecTonalpohualli.tonal_name(730739)
1
iex>Elixir.AztecTonalpohualli.tonal_name(730739, :atom)
:tonal_name
iex>Elixir.AztecTonalpohualli.tonal_name(730739, :index)
1
iex>Elixir.AztecTonalpohualli.tonal_name(730739, :name)
"Tonal_name"
iex>Elixir.AztecTonalpohualli.tonal_name(730739, :value)
1
iex>Elixir.AztecTonalpohualli.tonal_name({6, 1})
1
iex>Elixir.AztecTonalpohualli.tonal_name({6, 1}, :atom)
:tonal_name
iex>Elixir.AztecTonalpohualli.tonal_name({6, 1}, :index)
1
iex>Elixir.AztecTonalpohualli.tonal_name({6, 1}, :name)
"Tonal_name"
iex>Elixir.AztecTonalpohualli.tonal_name({6, 1}, :value)
1 Specs
tonal_number( fixed() | aztec_tonalpohualli_date(), :atom | :index | :name | :value ) :: :atom | integer() | String.t() | number()
Returns the tonal_number field of a AztecTonalpohualli date.
The type parameter determines the type of the returned tonal_number:
:atomreturns the internal name of tonal_number,:indexreturns the position of the tonal_number field within the date,:namereturns the common name of the tonal_number,:valuereturns the value of the tonal_number (default).
Examples
iex>Elixir.AztecTonalpohualli.tonal_number(730739)
6
iex>Elixir.AztecTonalpohualli.tonal_number(730739, :atom)
:tonal_number
iex>Elixir.AztecTonalpohualli.tonal_number(730739, :index)
0
iex>Elixir.AztecTonalpohualli.tonal_number(730739, :name)
"Tonal_number"
iex>Elixir.AztecTonalpohualli.tonal_number(730739, :value)
6
iex>Elixir.AztecTonalpohualli.tonal_number({6, 1})
6
iex>Elixir.AztecTonalpohualli.tonal_number({6, 1}, :atom)
:tonal_number
iex>Elixir.AztecTonalpohualli.tonal_number({6, 1}, :index)
0
iex>Elixir.AztecTonalpohualli.tonal_number({6, 1}, :name)
"Tonal_number"
iex>Elixir.AztecTonalpohualli.tonal_number({6, 1}, :value)
6