common: implement extended Haabʼ with year numbers

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.
This commit is contained in:
Quantum 2025-07-11 00:31:33 -04:00
parent 7a3e62df17
commit 5e9e9e7fae

View file

@ -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 {