lua-calendrica

# Module `calendrica-julian`

Julian calendar conversions, Roman calendar, AUC/Olympiad helpers.

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

bce (n) | Return a negative year number representing `n` BCE on the Julian calendar.
ce (n) | Return a positive year number representing `n` CE on the Julian calendar.
julian_date (year, month, day) | Construct a Julian date from year, month, and day.
julian_leap_year (j_year) | True if `j_year` is a leap year on the Julian calendar.
fixed_from_julian (j_date) | Fixed date equivalent to the Julian date `j_date`.
julian_from_fixed (date) | Julian date {year, month, day} corresponding to fixed `date`.
roman_date (year, month, event, count, leap) | Construct a Roman calendar date.
fixed_from_roman (r_date) | Fixed date for Roman name `r_date`.
roman_from_fixed (date) | Roman name for fixed `date`.
auc_year_from_julian (j_year) | AUC year equivalent to Julian year `j_year`.
julian_year_from_auc (year) | Julian year equivalent to AUC year `year`.
olympiad_from_julian_year (j_year) | Olympiad {cycle, year} corresponding to Julian year `j_year`.
julian_year_from_olympiad (o_date) | Julian year corresponding to Olympiad `o_date`.
julian_in_gregorian (j_month, j_day, g_year) | Fixed dates of Julian month `j_month`, day `j_day` that fall in Gregorian year `g_year`.
eastern_orthodox_christmas (g_year) | Fixed dates of Eastern Orthodox Christmas (Julian Dec 25) in Gregorian year `g_year`.
julian_season_in_gregorian (season, g_year) | Moments of Julian solar season in Gregorian year `g_year`.

## Fields

JANUARY | January month number (1).
FEBRUARY | February month number (2).
MARCH | March month number (3).
APRIL | April month number (4).
MAY | May month number (5).
JUNE | June month number (6).
JULY | July month number (7).
AUGUST | August month number (8).
SEPTEMBER | September month number (9).
OCTOBER | October month number (10).
NOVEMBER | November month number (11).
DECEMBER | December month number (12).
KALENDS | Roman calendar event class: Kalends.
NONES | Roman calendar event class: Nones.
IDES | Roman calendar event class: Ides.

## Functions

bce (n)
  Return a negative year number representing `n` BCE on the Julian calendar.

  ### Parameters:

  - n number Positive year count before the common era.

  ### Returns:

  number Negative Julian year.
ce (n)
  Return a positive year number representing `n` CE on the Julian calendar.

  ### Parameters:

  - n number Year in the common era.

  ### Returns:

  number Julian year.
julian_date (year, month, day)
  Construct a Julian date from year, month, and day.

  ### Parameters:

  - year number Julian year (use bce/ce helpers).
  - month number Month (1–12).
  - day number Day of month.

  ### Returns:

  table {year, month, day}
julian_leap_year (j_year)
  True if `j_year` is a leap year on the Julian calendar.

  ### Parameters:

  - j_year number Julian year.

  ### Returns:

  boolean
fixed_from_julian (j_date)
  Fixed date equivalent to the Julian date `j_date`.

  ### Parameters:

  - j_date table Julian date {year, month, day}.

  ### Returns:

  number Fixed date.
julian_from_fixed (date)
  Julian date {year, month, day} corresponding to fixed `date`.

  ### Parameters:

  - date number Fixed date.

  ### Returns:

  table {year, month, day}
roman_date (year, month, event, count, leap)
  Construct a Roman calendar date.

  ### Parameters:

  - year number Julian year.
  - month number Month (1–12).
  - event number Roman event (KALENDS, NONES, or IDES).
  - count number Count before the event.
  - leap boolean True for the leap-day variant in March of a leap year.

  ### Returns:

  table {year, month, event, count, leap}
fixed_from_roman (r_date)
  Fixed date for Roman name `r_date`.

  ### Parameters:

  - r_date table Roman date {year, month, event, count, leap}.

  ### Returns:

  number Fixed date.
roman_from_fixed (date)
  Roman name for fixed `date`.

  ### Parameters:

  - date number Fixed date.

  ### Returns:

  table Roman date {year, month, event, count, leap}.
auc_year_from_julian (j_year)
  AUC year equivalent to Julian year `j_year`.

  ### Parameters:

  - j_year number Julian year.

  ### Returns:

  number AUC year.
julian_year_from_auc (year)
  Julian year equivalent to AUC year `year`.

  ### Parameters:

  - year number AUC year.

  ### Returns:

  number Julian year.
olympiad_from_julian_year (j_year)
  Olympiad {cycle, year} corresponding to Julian year `j_year`.

  ### Parameters:

  - j_year number Julian year.

  ### Returns:

  table {cycle, year}
julian_year_from_olympiad (o_date)
  Julian year corresponding to Olympiad `o_date`.

  ### Parameters:

  - o_date table Olympiad {cycle, year}.

  ### Returns:

  number Julian year.
julian_in_gregorian (j_month, j_day, g_year)
  Fixed dates of Julian month `j_month`, day `j_day` that fall in Gregorian year `g_year`.

  ### Parameters:

  - j_month number Julian month (1–12).
  - j_day number Julian day.
  - g_year number Gregorian year.

  ### Returns:

  table List of fixed dates (0, 1, or 2 entries).
eastern_orthodox_christmas (g_year)
  Fixed dates of Eastern Orthodox Christmas (Julian Dec 25) in Gregorian year `g_year`. Returns a list of 0 or 1 dates.

  ### Parameters:

  - g_year number Gregorian year.

  ### Returns:

  table List of fixed dates.
julian_season_in_gregorian (season, g_year)
  Moments of Julian solar season in Gregorian year `g_year`. Uses the Julian year length (365.25 days) rather than the tropical year. `season` is a solar longitude (0=spring, 90=summer, 180=autumn, 270=winter).

  ### Parameters:

  - season number Solar longitude of season (degrees).
  - g_year number Gregorian year.

  ### Returns:

  {number,...} Moments.

## Fields

JANUARY
  January month number (1).
FEBRUARY
  February month number (2).
MARCH
  March month number (3).
APRIL
  April month number (4).
MAY
  May month number (5).
JUNE
  June month number (6).
JULY
  July month number (7).
AUGUST
  August month number (8).
SEPTEMBER
  September month number (9).
OCTOBER
  October month number (10).
NOVEMBER
  November month number (11).
DECEMBER
  December month number (12).
KALENDS
  Roman calendar event class: Kalends.
NONES
  Roman calendar event class: Nones.
IDES
  Roman calendar event class: Ides.

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