From d0d2ebcac5e39342986e17576c3fb8569d0c7743 Mon Sep 17 00:00:00 2001 From: Quantum Date: Tue, 17 Jun 2025 22:04:14 -0400 Subject: [PATCH] common: implement jdnTzolkin --- common/src/mayan.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common/src/mayan.ts b/common/src/mayan.ts index 0e0d16e..1058d5c 100644 --- a/common/src/mayan.ts +++ b/common/src/mayan.ts @@ -58,3 +58,10 @@ export function tzolkinName(name: TzolkinName): string { export function formatTzolkin(tzolkin: Tzolkin): string { return `${tzolkin.number} ${tzolkinName(tzolkin.name)}`; } + +export function jdnTzolkin(jdn: number): Tzolkin { + return { + number: ((jdn % 13 + 18) % 13 + 1) as TzolkinNumber, + name: (jdn % 20 + 36) % 20, + }; +}