Reference · The same, with suncalc 1's conventions (radians, azimuth from south)
getTimesfunction
The Sun's times for the solar day nearest a moment, as suncalc 1 gave them: every time a Date, invalid when it does not happen.
Import it
import { getTimes } from "@johnmorrisdotca/wakusei-planets/suncalc/legacy";
Definition
function getTimes(date: Date | number, lat: number, lng: number, height?: number): LegacySunTimes
Parameters
| Name | Type | Description |
|---|---|---|
date | number | Date | Any moment of the day. |
lat | number | Degrees north. |
lng | number | Degrees east. |
height (optional) | number | The observer's height in metres (default 0). |
Returns
LegacySunTimes
The times by name.
Examples
import { getTimes } from "@johnmorrisdotca/wakusei-planets/suncalc/legacy";
const t = getTimes(new Date(Date.UTC(2026, 5, 21, 12)), 51.5, -0.1);
console.log(t.sunrise!.getTime() < t.sunset!.getTime());trueWhat it prints (run when this page was built)