Skip to content

Tempo Plugin

@magmacomputing/tempo-plugin-roman ​

npm version npm peer dependency version License TypeScript Ready

A lightweight, zero-dependency Community plugin for the Tempo ecosystem that provides classical Roman calendar arithmetic (Kalends, Nones, Ides, Ante Diem), leap year bissextile handling, and AUC (Ab Urbe Condita) year conversions.


Key Features ​

  • Classical Anchors: Resolves any date to its Roman Kalends, Nones, or Ides anchor, including Pridie and inclusive ante diem counts.
  • Latin Phrasing: Emits full (ante diem XVII Kalendas Novembres) and abbreviated (a.d. XVII Kal. Nov.) forms with correct Ablative/Accusative declensions.
  • Bissextile Day: Reproduces the classical leap-year doubling of the sixth day before the March Kalends (a.d. bis VI Kal. Mart.).
  • AUC Year Reckoning: Bidirectional Ab Urbe Condita conversion for CE, BCE, and astronomical years.
  • Classical Latin Parser: Robust parser recognizing arbitrary Latin expressions (e.g. a.d. IV Id. Mart. 710 AUC, Idibus Martiis Cicerone coss.) with calendar validation.
  • Fasti Consulares (509 BCE–541 CE): Historical catalog of Roman Consuls with Latin ablative absolute (coss.) formatting and searching (full catalog via ./consuls, with landmark years in core).
  • Lossless Round-Trips: Tempo.roman.fromClassical() maps any classical date back to its exact calendar day.
  • Immutable Results: Every structured result is frozen; zero runtime dependencies beyond Tempo.

Installation & Import Paths ​

bash
npm install @magmacomputing/tempo-plugin-roman

Choose Your Import Path ​

Import PathMinified SizeWhat's Included
import '@magmacomputing/tempo-plugin-roman/install'~15 KBFull Roman calendar arithmetic, Latin phrasing/parsing, AUC conversions, and ~20 landmark consul years (Cicero, Caesar, Brutus, Basilius). Auto-installs plugin.
import '@magmacomputing/tempo-plugin-roman/consuls'~70 KBBatteries-included: full Roman calendar plugin + complete 1,050-year Fasti consulares catalog (509 BCE–541 CE). Auto-installs plugin in one import.
import { RomanPlugin } from '@magmacomputing/tempo-plugin-roman'~15 KBCore plugin definition for explicit installation via Tempo.use(RomanPlugin).

Quickstart ​

Interactive Demo (@magmacomputing/tempo-plugin-roman)
Open in Full REPL↗
// 🏛️ Classical Roman Calendar, Parsing & Consuls (@magmacomputing/tempo-plugin-roman)
const { RomanPlugin } = await import('@magmacomputing/tempo-plugin-roman/consuls');
Tempo.use(RomanPlugin);

// 1. Classical Date Formatting & Declensions
const today = new Tempo('2026-10-16');
console.log('Today (Latin):', today.format('{roman:classical}')); // "ante diem XVII Kalendas Novembres"
console.log('Abbreviated:  ', today.format('{roman:short}'));     // "a.d. XVII Kal. Nov."
console.log('Year AUC:     ', today.format('{roman:auc}'));       // "AUC MMDCCLXXIX"

// 2. The Ides of March (44 BCE = -43)
const ides44 = new Tempo('-000043-03-15');
console.log('Ides of March:', ides44.format('{roman:classical}')); // "Idibus Martiis"
console.log('Presiding Consuls:', ides44.consuls);                 // "C. Julio Caesare V, M. Antonio coss."

// 3. Classical Latin Expression Parser (Phase 3)
const parsed = Tempo.roman.parse('a.d. IV Id. Mart. 710 AUC');
console.log('Parsed expression:', parsed.format('{yyyy}-{mm}-{dd}')); // "-000043-03-12"

// 4. Consular Fasti Search (509 BCE–541 CE)
const ciceroEntries = Tempo.roman.findConsuls('Cicero');
console.log('Cicero Consulship:', ciceroEntries[0]?.formatted);

// 5. Parse date by consular pair
const byConsuls = Tempo.roman.parse('Idibus Martiis Cicerone coss.');
console.log('Consular Date:', byConsuls.format('{yyyy}-{mm}-{dd}')); // "-000062-03-15" (63 BCE)

return `Today: ${today.format('{roman:classical}')} (${today.auc} AUC)`;
Executes 100% in browser via native ESM sandbox

Option A: Lean Core Plugin (Zero-Boilerplate) ​

typescript
import '@magmacomputing/tempo-plugin-roman/install';
import { Tempo } from '@magmacomputing/tempo';

// 1. Compute classical Roman date and Latin phrasing
const today = new Tempo('2026-10-16');
const classical = today.toRomanClassical();

console.log(`Roman Date: ${classical.latin}`);      // "ante diem XVII Kalendas Novembres"
console.log(`Abbreviated: ${classical.shortLatin}`);// "a.d. XVII Kal. Nov."
console.log(`Anchor: ${classical.anchor}`);         // "Kalends"
console.log(`Year AUC: ${today.auc} AUC`);          // 2779 AUC

// 2. Ides of March (44 BCE = astronomical year -43)
const idesOfMarch = new Tempo('-000043-03-15');
console.log(idesOfMarch.toRomanClassical().latin);  // "Idibus Martiis"
console.log(idesOfMarch.toAUC());                   // 710 (AUC)
console.log(idesOfMarch.consuls);                  // "C. Julio Caesare V, M. Antonio coss."

// 3. Leap year bissextile day (February 24 in a leap year)
const leapDay = new Tempo('2024-02-24');
console.log(leapDay.toRomanClassical().latin);      // "ante diem bis sextum Kalendas Martias"
console.log(leapDay.toRomanClassical().shortLatin); // "a.d. bis VI Kal. Mart."

// 4. Classical Latin Date Parsing
const parsed = Tempo.roman.parse('a.d. IV Id. Mart. 710 AUC');
console.log(parsed.format('{yyyy}-{mm}-{dd}'));     // "-000043-03-12" (March 12, 44 BCE)

Option B: Full Consular Fasti (Single Import) ​

To access the complete historical Fasti consulares spanning all 1,050 years from 509 BCE through 541 CE:

typescript
import '@magmacomputing/tempo-plugin-roman/consuls';
import { Tempo } from '@magmacomputing/tempo';

// Auto-installs RomanPlugin AND populates all 1,050 consular years
const trajanYear = new Tempo('0100-01-01');
console.log(trajanYear.consuls);
// "Imp. Caesare Nerva Trajano Augusto III, Sex. Julio Frontino III coss."

console.log(trajanYear.format('{roman:consul}'));
// "Imp. Caesare Nerva Trajano Augusto III, Sex. Julio Frontino III coss."

Option C: Explicit Plugin Registration ​

typescript
import { Tempo } from '@magmacomputing/tempo';
import { RomanPlugin } from '@magmacomputing/tempo-plugin-roman';

Tempo.use(RomanPlugin);

API Reference ​

tempo.toRomanClassical(options?: RomanCalculationOptions): ClassicalRomanDate ​

Instance method calculating the complete classical Roman calendar descriptor for the instance date. Returns an immutable, frozen ClassicalRomanDate object.

tempo.toAUC(): number ​

Instance method returning the year reckoned Ab Urbe Condita (AUC).

tempo.auc: number ​

Getter returning the year in AUC.

Tempo.roman.toClassical(date, options?): ClassicalRomanDate ​

Static calculation function resolving Tempo, native JavaScript Date, or plain { year, month, day } objects into a frozen ClassicalRomanDate.

Tempo.roman.fromClassical(anchor, anchorMonth, anchorYear, relation, count?, isBissextile?, isJulian?): { year, month, day } ​

Resolves classical Roman calendar anchor parameters back to modern calendar coordinates.

Tempo.roman.parse(input: string, options?: RomanParseOptions): Tempo ​

Parses a natural classical Latin date string (e.g. 'a.d. IV Id. Mart. 710 AUC' or 'Idibus Martiis Cicerone coss.') directly into a Tempo instance.

Tempo.roman.parseDate(input: string, options?: RomanParseOptions): ParsedRomanDate ​

Parses a Latin date string into calendar coordinates ({ year, month, day, auc, classical }) without constructing an instance.

Tempo.roman.getConsuls(year: number): readonly string[] | undefined ​

Retrieves the eponymous Roman consuls for an astronomical year from the Fasti consulares (509 BCE–541 CE).

Tempo.roman.formatConsuls(year: number, style?: 'ablative' | 'nominative'): string | undefined ​

Renders the eponymous consuls into a classical Latin dating formula (e.g. "M. Tullio Cicerone, C. Antonio Hybrida coss.").

Tempo.roman.findConsuls(query: string): ConsularPair[] ​

Performs a substring search against the Fasti consulares and returns matching years and names.

Tempo.roman.yearToAuc(year: number, era?: 'CE' | 'BCE'): number ​

Converts an astronomical year (or positive BCE year with explicit era) into AUC.

Tempo.roman.aucToYear(auc: number, format?: 'astronomical' | 'historical') ​

Converts an AUC year into an astronomical integer or { year, era: 'CE' | 'BCE' }.

Tempo.roman.getNonesDay(month: number): number ​

Returns 7 for MOM-J months (March, October, May, July) and 5 for all other months.

Tempo.roman.getIdesDay(month: number): number ​

Returns 15 for MOM-J months (March, October, May, July) and 13 for all other months.

Tempo.roman.isLeapYear(year: number, isJulian?: boolean): boolean ​

Evaluates leap year status under Gregorian or Julian calendar rules.


Topic Guides ​


License ​

This is a Community plugin. It is completely free and open-source for personal and commercial use under the MIT license.

Released under the MIT License.