mirror of
https://github.com/quantum5/qcal.git
synced 2025-07-28 20:24:08 -04:00
21 lines
425 B
TypeScript
21 lines
425 B
TypeScript
export type LongCount = Array<number>;
|
|
|
|
export function jdnLongCount(jdn: number): LongCount | null {
|
|
let z = jdn - 584283;
|
|
if (z < 0)
|
|
return null;
|
|
|
|
const parts = [z % 20, Math.floor(z / 20) % 18];
|
|
z = Math.floor(z / 360);
|
|
while (z > 0) {
|
|
parts.push(z % 20);
|
|
z = Math.floor(z / 20);
|
|
}
|
|
|
|
while (parts.length < 5) {
|
|
parts.push(0);
|
|
}
|
|
|
|
return parts.reverse();
|
|
}
|