AztecXiuhmolpilli (Calendars v0.2.4) View Source

The AztecXiuhmolpilli 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 AztecXiuhmolpilli date as a AztecXiuhmolpilli date.

Returns a AztecXiuhmolpilli date from its fields xiuhmol_number, xiuhmol_name.

Returns the name of the field atom in a AztecXiuhmolpilli date at field_index.

Returns a list of the field atoms (names) of a AztecXiuhmolpilli date.

Returns the number of fields in a AztecXiuhmolpilli date

Returns the index (= position) of the field_atom in a AztecXiuhmolpilli date.

Converts the other_date of the other_calendar into the equivalent date of the AztecXiuhmolpilli calendar.

Converts a fixed day to a AztecXiuhmolpilli date.

Converts a Julian Day into the equivalent AztecXiuhmolpilli date.

Converts a RataDie date into the equivalent AztecXiuhmolpilli date.

Converts a Unix date into the equivalent AztecXiuhmolpilli date.

Returns the internal keyword of the AztecXiuhmolpilli calendar.

Returns the module of the AztecXiuhmolpilli calendar.

Returns the internal name of the AztecXiuhmolpilli calendar.

Returns the xiuhmol_name field of a AztecXiuhmolpilli date.

Returns the xiuhmol_number field of a AztecXiuhmolpilli date.

Link to this section Types

Link to this type

aztec_xiuhmolpilli_date()

View Source

Specs

Link to this type

aztec_xiuhmolpilli_xiuhmol_name()

View Source

Specs

aztec_xiuhmolpilli_xiuhmol_name() :: 1 | 8 | 13 | 18
Link to this type

aztec_xiuhmolpilli_xiuhmol_number()

View Source

Specs

aztec_xiuhmolpilli_xiuhmol_number() :: 1..13

Specs

fixed() :: integer()

Specs

Link to this section Functions

Specs

Returns a fixed day or AztecXiuhmolpilli date as a AztecXiuhmolpilli date.

This is a convenience function to simplify certain function calls.

Examples

  iex>Elixir.AztecXiuhmolpilli.as_date(730739)
  {2, 3}
  iex>Elixir.AztecXiuhmolpilli.as_date({2, 3})
  {2, 3}
Link to this function

date(xiuhmol_number, xiuhmol_name)

View Source

Specs

Returns a AztecXiuhmolpilli date from its fields xiuhmol_number, xiuhmol_name.

Example

  iex>Elixir.AztecXiuhmolpilli.date(2, 3)
  {2, 3}

Specs

field_atom(integer()) :: atom()

Returns the name of the field atom in a AztecXiuhmolpilli date at field_index.

Examples

  iex>Elixir.AztecXiuhmolpilli.field_atom(0)
  :xiuhmol_number
  iex>Elixir.AztecXiuhmolpilli.field_atom(1)
  :xiuhmol_name

Specs

field_atoms() :: [atom()]

Returns a list of the field atoms (names) of a AztecXiuhmolpilli date.

Example

  iex>Elixir.AztecXiuhmolpilli.field_atoms()
  [:xiuhmol_number, :xiuhmol_name]

Specs

field_count() :: integer()

Returns the number of fields in a AztecXiuhmolpilli date

Example

  iex>Elixir.AztecXiuhmolpilli.field_count()
  2

Specs

field_index(atom()) :: integer()

Returns the index (= position) of the field_atom in a AztecXiuhmolpilli date.

Examples

  iex>Elixir.AztecXiuhmolpilli.field_index(:xiuhmol_number)
  0
  iex>Elixir.AztecXiuhmolpilli.field_index(:xiuhmol_name)
  1
Link to this function

from_date(other_date, other_calendar)

View Source

Specs

from_date(tuple(), module()) :: aztec_xiuhmolpilli_date()
from_date(tuple(), module()) :: {:error, String.t()}

Converts the other_date of the other_calendar into the equivalent date of the AztecXiuhmolpilli calendar.

Example

  iex>Elixir.AztecXiuhmolpilli.from_date({2001, 9, 11}, Gregorian)
  {2, 3}

Specs

from_fixed(fixed()) :: aztec_xiuhmolpilli_date()

Converts a fixed day to a AztecXiuhmolpilli date.

Example

  iex>Elixir.AztecXiuhmolpilli.from_fixed(730739)
  {2, 3}

Specs

from_jd(tuple() | number()) :: aztec_xiuhmolpilli_date()

Converts a Julian Day into the equivalent AztecXiuhmolpilli date.

The Julian Day can be given as a tuple or by a Julian day.

Examples

  iex>Elixir.AztecXiuhmolpilli.from_jd({2452163.5})
  {2, 3}
  iex>Elixir.AztecXiuhmolpilli.from_jd(2452163.5)
  {2, 3}

Specs

from_rata_die(tuple() | integer()) :: aztec_xiuhmolpilli_date()

Converts a RataDie date into the equivalent AztecXiuhmolpilli date.

The RataDie date can be given as a tuple or by a RataDie rd.

Examples

  iex>Elixir.AztecXiuhmolpilli.from_rata_die({730739})
  {2, 3}
  iex>Elixir.AztecXiuhmolpilli.from_rata_die(730739)
  {2, 3}

Specs

from_unix(tuple() | integer()) :: aztec_xiuhmolpilli_date()

Converts a Unix date into the equivalent AztecXiuhmolpilli date.

The Unix date can be given as a tuple or by Unix seconds.

Examples

  iex>Elixir.AztecXiuhmolpilli.from_unix({1000166400})
  {2, 3}
  iex>Elixir.AztecXiuhmolpilli.from_unix(1000166400)
  {2, 3}

Specs

keyword() :: atom()

Returns the internal keyword of the AztecXiuhmolpilli calendar.

Example

  iex>Elixir.AztecXiuhmolpilli.keyword()
  :aztec_xiuhmolpilli

Specs

module() :: module()

Returns the module of the AztecXiuhmolpilli calendar.

Example

  iex>Elixir.AztecXiuhmolpilli.module()
  AztecXiuhmolpilli

Specs

name() :: atom()

Returns the internal name of the AztecXiuhmolpilli calendar.

Example

  iex>Elixir.AztecXiuhmolpilli.name()
  "AztecXiuhmolpilli"
Link to this function

xiuhmol_name(cal_date, type \\ :value)

View Source

Specs

xiuhmol_name(
  fixed() | aztec_xiuhmolpilli_date(),
  :atom | :index | :name | :value
) :: :atom | integer() | String.t() | number()

Returns the xiuhmol_name field of a AztecXiuhmolpilli date.

The type parameter determines the type of the returned xiuhmol_name:

  • :atom returns the internal name of xiuhmol_name,
  • :index returns the position of the xiuhmol_name field within the date,
  • :name returns the common name of the xiuhmol_name,
  • :value returns the value of the xiuhmol_name (default).

Examples

  iex>Elixir.AztecXiuhmolpilli.xiuhmol_name(730739)
  3
  iex>Elixir.AztecXiuhmolpilli.xiuhmol_name(730739, :atom)
  :xiuhmol_name
  iex>Elixir.AztecXiuhmolpilli.xiuhmol_name(730739, :index)
  1
  iex>Elixir.AztecXiuhmolpilli.xiuhmol_name(730739, :name)
  "Xiuhmol_name"
  iex>Elixir.AztecXiuhmolpilli.xiuhmol_name(730739, :value)
  3

  iex>Elixir.AztecXiuhmolpilli.xiuhmol_name({2, 3})
  3
  iex>Elixir.AztecXiuhmolpilli.xiuhmol_name({2, 3}, :atom)
  :xiuhmol_name
  iex>Elixir.AztecXiuhmolpilli.xiuhmol_name({2, 3}, :index)
  1
  iex>Elixir.AztecXiuhmolpilli.xiuhmol_name({2, 3}, :name)
  "Xiuhmol_name"
  iex>Elixir.AztecXiuhmolpilli.xiuhmol_name({2, 3}, :value)
  3
Link to this function

xiuhmol_number(cal_date, type \\ :value)

View Source

Specs

xiuhmol_number(
  fixed() | aztec_xiuhmolpilli_date(),
  :atom | :index | :name | :value
) :: :atom | integer() | String.t() | number()

Returns the xiuhmol_number field of a AztecXiuhmolpilli date.

The type parameter determines the type of the returned xiuhmol_number:

  • :atom returns the internal name of xiuhmol_number,
  • :index returns the position of the xiuhmol_number field within the date,
  • :name returns the common name of the xiuhmol_number,
  • :value returns the value of the xiuhmol_number (default).

Examples

  iex>Elixir.AztecXiuhmolpilli.xiuhmol_number(730739)
  2
  iex>Elixir.AztecXiuhmolpilli.xiuhmol_number(730739, :atom)
  :xiuhmol_number
  iex>Elixir.AztecXiuhmolpilli.xiuhmol_number(730739, :index)
  0
  iex>Elixir.AztecXiuhmolpilli.xiuhmol_number(730739, :name)
  "Xiuhmol_number"
  iex>Elixir.AztecXiuhmolpilli.xiuhmol_number(730739, :value)
  2

  iex>Elixir.AztecXiuhmolpilli.xiuhmol_number({2, 3})
  2
  iex>Elixir.AztecXiuhmolpilli.xiuhmol_number({2, 3}, :atom)
  :xiuhmol_number
  iex>Elixir.AztecXiuhmolpilli.xiuhmol_number({2, 3}, :index)
  0
  iex>Elixir.AztecXiuhmolpilli.xiuhmol_number({2, 3}, :name)
  "Xiuhmol_number"
  iex>Elixir.AztecXiuhmolpilli.xiuhmol_number({2, 3}, :value)
  2