From 5e9e9e7fae5fa8979465521327b4d5e521263dc4 Mon Sep 17 00:00:00 2001 From: Quantum Date: Fri, 11 Jul 2025 00:31:33 -0400 Subject: [PATCH] =?UTF-8?q?common:=20implement=20extended=20Haab=CA=BC=20w?= =?UTF-8?q?ith=20year=20numbers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We define year 0 as the year with the Mayan creation, i.e. Long Count date 0.0.0.0.0, with years incrementing every 0 Pop. --- common/src/mayan.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/common/src/mayan.ts b/common/src/mayan.ts index 5186c7d..d83dd4d 100644 --- a/common/src/mayan.ts +++ b/common/src/mayan.ts @@ -108,6 +108,17 @@ export function jdnHaab(jdn: number): Haab { }; } +export type HaabExt = Haab & { + year: number, +}; + +export function jdnHaabExt(jdn: number): HaabExt { + return { + ...jdnHaab(jdn), + year: Math.floor((jdn - 583935) / 365), + }; +} + export type LordOfNight = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9; export function formatLordOfNight(lordOfNight: LordOfNight): string {