sunPositionfunction
The Sun's right ascension and declination of date, in degrees, from the Almanac's low-precision formula (0.01 degree from 1950 to 2050). No clock is read: the moment is passed in.
Import it
import { sunPosition } from "@johnmorrisdotca/hoshi-stars/tonight";
Definition
function sunPosition(when: When): { rightAscension: number; declination: number; }
Parameters
| Name | Type | Description |
|---|---|---|
when | When | The moment, a |
Returns
{ rightAscension: number; declination: number; }
{ rightAscension, declination } of the equinox of the date, in degrees.
Examples
import { sunPosition } from "@johnmorrisdotca/hoshi-stars/tonight";
// the June solstice: the Sun is as far north as it gets, 23.4 degrees
console.log(sunPosition(Date.UTC(2026, 5, 21, 8, 24)).declination.toFixed(1)); // 23.423.4What it prints (run when this page was built)