AztecXihuitl (Calendars v0.2.4) View Source

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

Returns a AztecXihuitl date from its fields month, day.

Returns the day field of a AztecXihuitl date.

Returns the epoch of the AztecXihuitl calendar.

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

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

Returns the number of fields in a AztecXihuitl date

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

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

Converts a fixed day to a AztecXihuitl date.

Converts a Julian Day into the equivalent AztecXihuitl date.

Converts a RataDie date into the equivalent AztecXihuitl date.

Converts a Unix date into the equivalent AztecXihuitl date.

Returns the internal keyword of the AztecXihuitl calendar.

Returns the module of the AztecXihuitl calendar.

Returns the month field of a AztecXihuitl date.

Returns the internal name of the AztecXihuitl calendar.

Link to this section Types

Specs

aztec_xihuitl_date() :: {aztec_xihuitl_month(), aztec_xihuitl_day()}

Specs

aztec_xihuitl_day() :: 1..20

Specs

aztec_xihuitl_month() :: 1..19

Specs

fixed() :: integer()

Specs

Link to this section Functions

Specs

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

This is a convenience function to simplify certain function calls.

Examples

  iex>Elixir.AztecXihuitl.as_date(730739)
  {17, 18}
  iex>Elixir.AztecXihuitl.as_date({17, 18})
  {17, 18}

Specs

Returns a AztecXihuitl date from its fields month, day.

Example

  iex>Elixir.AztecXihuitl.date(17, 18)
  {17, 18}
Link to this function

day(cal_date, type \\ :value)

View Source

Specs

day(fixed() | aztec_xihuitl_date(), :atom | :index | :name | :value) ::
  :atom | integer() | String.t() | number()

Returns the day field of a AztecXihuitl 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.AztecXihuitl.day(730739)
  18
  iex>Elixir.AztecXihuitl.day(730739, :atom)
  :day
  iex>Elixir.AztecXihuitl.day(730739, :index)
  1
  iex>Elixir.AztecXihuitl.day(730739, :name)
  "Day"
  iex>Elixir.AztecXihuitl.day(730739, :value)
  18

  iex>Elixir.AztecXihuitl.day({17, 18})
  18
  iex>Elixir.AztecXihuitl.day({17, 18}, :atom)
  :day
  iex>Elixir.AztecXihuitl.day({17, 18}, :index)
  1
  iex>Elixir.AztecXihuitl.day({17, 18}, :name)
  "Day"
  iex>Elixir.AztecXihuitl.day({17, 18}, :value)
  18

Specs

epoch() :: number()

Returns the epoch of the AztecXihuitl calendar.

Example

  iex>Elixir.AztecXihuitl.epoch()
  555202

Specs

field_atom(integer()) :: atom()

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

Examples

  iex>Elixir.AztecXihuitl.field_atom(0)
  :month
  iex>Elixir.AztecXihuitl.field_atom(1)
  :day

Specs

field_atoms() :: [atom()]

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

Example

  iex>Elixir.AztecXihuitl.field_atoms()
  [:month, :day]

Specs

field_count() :: integer()

Returns the number of fields in a AztecXihuitl date

Example

  iex>Elixir.AztecXihuitl.field_count()
  2

Specs

field_index(atom()) :: integer()

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

Examples

  iex>Elixir.AztecXihuitl.field_index(:month)
  0
  iex>Elixir.AztecXihuitl.field_index(:day)
  1
Link to this function

from_date(other_date, other_calendar)

View Source

Specs

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

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

Example

  iex>Elixir.AztecXihuitl.from_date({2001, 9, 11}, Gregorian)
  {17, 18}

Specs

from_fixed(fixed()) :: aztec_xihuitl_date()

Converts a fixed day to a AztecXihuitl date.

Example

  iex>Elixir.AztecXihuitl.from_fixed(730739)
  {17, 18}

Specs

from_jd(tuple() | number()) :: aztec_xihuitl_date()

Converts a Julian Day into the equivalent AztecXihuitl date.

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

Examples

  iex>Elixir.AztecXihuitl.from_jd({2452163.5})
  {17, 18}
  iex>Elixir.AztecXihuitl.from_jd(2452163.5)
  {17, 18}

Specs

from_rata_die(tuple() | integer()) :: aztec_xihuitl_date()

Converts a RataDie date into the equivalent AztecXihuitl date.

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

Examples

  iex>Elixir.AztecXihuitl.from_rata_die({730739})
  {17, 18}
  iex>Elixir.AztecXihuitl.from_rata_die(730739)
  {17, 18}

Specs

from_unix(tuple() | integer()) :: aztec_xihuitl_date()

Converts a Unix date into the equivalent AztecXihuitl date.

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

Examples

  iex>Elixir.AztecXihuitl.from_unix({1000166400})
  {17, 18}
  iex>Elixir.AztecXihuitl.from_unix(1000166400)
  {17, 18}

Specs

keyword() :: atom()

Returns the internal keyword of the AztecXihuitl calendar.

Example

  iex>Elixir.AztecXihuitl.keyword()
  :aztec_xihuitl

Specs

module() :: module()

Returns the module of the AztecXihuitl calendar.

Example

  iex>Elixir.AztecXihuitl.module()
  AztecXihuitl
Link to this function

month(cal_date, type \\ :value)

View Source

Specs

month(fixed() | aztec_xihuitl_date(), :atom | :index | :name | :value) ::
  :atom | integer() | String.t() | number()

Returns the month field of a AztecXihuitl 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.AztecXihuitl.month(730739)
  17
  iex>Elixir.AztecXihuitl.month(730739, :atom)
  :month
  iex>Elixir.AztecXihuitl.month(730739, :index)
  0
  iex>Elixir.AztecXihuitl.month(730739, :name)
  "Month"
  iex>Elixir.AztecXihuitl.month(730739, :value)
  17

  iex>Elixir.AztecXihuitl.month({17, 18})
  17
  iex>Elixir.AztecXihuitl.month({17, 18}, :atom)
  :month
  iex>Elixir.AztecXihuitl.month({17, 18}, :index)
  0
  iex>Elixir.AztecXihuitl.month({17, 18}, :name)
  "Month"
  iex>Elixir.AztecXihuitl.month({17, 18}, :value)
  17

Specs

name() :: atom()

Returns the internal name of the AztecXihuitl calendar.

Example

  iex>Elixir.AztecXihuitl.name()
  "AztecXihuitl"