lua-calendrica

# Module `calendrica-mayan`

Mayan and Aztec calendar conversions.

Ported from "Calendrical Calculations" (4th edition) by Nachum Dershowitz and Edward M. Reingold. Original Lisp code (CALENDRICA 4.0) is Apache 2.0 licensed.

### Info:

- Release: 0.1 2026-07-19

## Functions

fixed_from_mayan_long_count (count) | Fixed date corresponding to Mayan long count `count`.
mayan_long_count_from_fixed (date) | Mayan long count date {baktun,katun,tun,uinal,kin} of fixed `date`.
mayan_haab_from_fixed (date) | Mayan haab date {month, day} of fixed `date`.
mayan_tzolkin_from_fixed (date) | Mayan tzolkin date {number, name} of fixed `date`.
aztec_xihuitl_from_fixed (date) | Aztec xihuitl date {month, day} of fixed `date`.
aztec_tonalpohualli_from_fixed (date) | Aztec tonalpohualli date {number, name} of fixed `date`.
mayan_haab_on_or_before (haab, date) | Latest fixed date on or before `date` with Mayan Haab date `haab`.
mayan_tzolkin_on_or_before (tzolkin, date) | Latest fixed date on or before `date` with Mayan Tzolkin date `tzolkin`.
mayan_calendar_round_on_or_before (haab, tzolkin, date) | Latest fixed date on or before `date` with Mayan Calendar Round `haab`+`tzolkin`.
mayan_year_bearer_from_fixed (date) | Year bearer of fixed `date` in the Mayan calendar.
aztec_xihuitl_on_or_before (xihuitl, date) | Latest fixed date on or before `date` with Aztec Xihuitl date `xihuitl`.
aztec_tonalpohualli_on_or_before (tonalpohualli, date) | Latest fixed date on or before `date` with Aztec Tonalpohualli date `tonalpohualli`.
aztec_xiuhmolpilli_from_fixed (date) | Aztec Xiuhmolpilli (52-year cycle) designation for fixed `date`.

## Functions

fixed_from_mayan_long_count (count)
  Fixed date corresponding to Mayan long count `count`.

  ### Parameters:

  - count table Mayan long count date {baktun,katun,tun,uinal,kin}.

  ### Returns:

  number Fixed date.
mayan_long_count_from_fixed (date)
  Mayan long count date {baktun,katun,tun,uinal,kin} of fixed `date`.

  ### Parameters:

  - date number Fixed date.

  ### Returns:

  table {baktun, katun, tun, uinal, kin}
mayan_haab_from_fixed (date)
  Mayan haab date {month, day} of fixed `date`.

  ### Parameters:

  - date number Fixed date.

  ### Returns:

  table {month, day}
mayan_tzolkin_from_fixed (date)
  Mayan tzolkin date {number, name} of fixed `date`.

  ### Parameters:

  - date number Fixed date.

  ### Returns:

  table {number, name}
aztec_xihuitl_from_fixed (date)
  Aztec xihuitl date {month, day} of fixed `date`.

  ### Parameters:

  - date number Fixed date.

  ### Returns:

  table {month, day}
aztec_tonalpohualli_from_fixed (date)
  Aztec tonalpohualli date {number, name} of fixed `date`.

  ### Parameters:

  - date number Fixed date.

  ### Returns:

  table {number, name}
mayan_haab_on_or_before (haab, date)
  Latest fixed date on or before `date` with Mayan Haab date `haab`.

  ### Parameters:

  - haab table Mayan Haab date {month, day}.
  - date number Fixed date.

  ### Returns:

  number Fixed date.
mayan_tzolkin_on_or_before (tzolkin, date)
  Latest fixed date on or before `date` with Mayan Tzolkin date `tzolkin`.

  ### Parameters:

  - tzolkin table Mayan Tzolkin date {number, name}.
  - date number Fixed date.

  ### Returns:

  number Fixed date.
mayan_calendar_round_on_or_before (haab, tzolkin, date)
  Latest fixed date on or before `date` with Mayan Calendar Round `haab`+`tzolkin`. Returns BOGUS if the combination is impossible.

  ### Parameters:

  - haab table Mayan Haab date {month, day}.
  - tzolkin table Mayan Tzolkin date {number, name}.
  - date number Fixed date.

  ### Returns:

  number Fixed date or BOGUS.
mayan_year_bearer_from_fixed (date)
  Year bearer of fixed `date` in the Mayan calendar.

  ### Parameters:

  - date number Fixed date.

  ### Returns:

  number Year bearer.
aztec_xihuitl_on_or_before (xihuitl, date)
  Latest fixed date on or before `date` with Aztec Xihuitl date `xihuitl`.

  ### Parameters:

  - xihuitl table Aztec Xihuitl date {month, day}.
  - date number Fixed date.

  ### Returns:

  number Fixed date.
aztec_tonalpohualli_on_or_before (tonalpohualli, date)
  Latest fixed date on or before `date` with Aztec Tonalpohualli date `tonalpohualli`.

  ### Parameters:

  - tonalpohualli table Aztec Tonalpohualli date {number, name}.
  - date number Fixed date.

  ### Returns:

  number Fixed date.
aztec_xiuhmolpilli_from_fixed (date)
  Aztec Xiuhmolpilli (52-year cycle) designation for fixed `date`. Returns BOGUS during Nemontemi (the 5 unlucky days).

  ### Parameters:

  - date number Fixed date.

  ### Returns:

  table or number Tonalpohualli date {number, name} or BOGUS.

generated by LDoc 1.5.0 Last updated 2026-07-19 03:28:25