getPositionfunction
The Sun's place in the sky from a place on the Earth.
Import it
import { getPosition } from "@johnmorrisdotca/wakusei-planets/suncalc";
Definition
function getPosition(date: Date | number, lat: number, lng: number): Position
Parameters
| Name | Type | Description |
|---|---|---|
date | number | Date | The moment, as a |
lat | number | Degrees north, -90 to 90. |
lng | number | Degrees east (west negative). |
Returns
Position
The azimuth (degrees clockwise from north) and the apparent altitude (degrees).
Examples
import { getPosition } from "@johnmorrisdotca/wakusei-planets/suncalc";
const { azimuth, altitude } = getPosition(new Date(Date.UTC(2026, 5, 21, 12)), 51.5, -0.1);
console.log(azimuth.toFixed(0), altitude.toFixed(0));179 62What it prints (run when this page was built)