Reference · The same, with suncalc 1's conventions (radians, azimuth from south)
getMoonPositionfunction
The Moon's place in the sky, as suncalc 1 gave it: the altitude includes refraction.
Import it
import { getMoonPosition } from "@johnmorrisdotca/wakusei-planets/suncalc/legacy";
Definition
function getMoonPosition(date: Date | number, lat: number, lng: number): LegacyMoonPosition
Parameters
| Name | Type | Description |
|---|---|---|
date | number | Date | The moment. |
lat | number | Degrees north. |
lng | number | Degrees east. |
Returns
LegacyMoonPosition
The azimuth and altitude in radians, the distance in kilometres and the parallactic angle in radians.
Examples
import { getMoonPosition } from "@johnmorrisdotca/wakusei-planets/suncalc/legacy";
const { distance } = getMoonPosition(new Date(Date.UTC(2026, 10, 7, 12)), 35.7, 139.7);
console.log(Math.round(distance / 1000));392What it prints (run when this page was built)