Reference · The same, with suncalc 1's conventions (radians, azimuth from south)
getMoonTimesfunction
The Moon's rise and set over the 24 hours from midnight of the moment's day, in the machine's zone or, with inUTC, in UTC.
Import it
import { getMoonTimes } from "@johnmorrisdotca/wakusei-planets/suncalc/legacy";
Definition
function getMoonTimes(date: Date | number, lat: number, lng: number, inUTC?: boolean): LegacyMoonTimes
Parameters
| Name | Type | Description |
|---|---|---|
date | number | Date | Any moment of the day. |
lat | number | Degrees north. |
lng | number | Degrees east. |
inUTC (optional) | boolean | Search the UTC day instead of the local one. |
Returns
LegacyMoonTimes
rise and set when they happen, and alwaysUp or alwaysDown when the Moon stays up or down.
Examples
import { getMoonTimes } from "@johnmorrisdotca/wakusei-planets/suncalc/legacy";
const t = getMoonTimes(new Date(Date.UTC(2026, 10, 7, 12)), 35.7, 139.7, true);
console.log(t.rise === undefined || t.rise instanceof Date);trueWhat it prints (run when this page was built)