SunTimestype
The Sun's times for a day: each a Date or null when the Sun does not reach that height that day, solarNoon and nadir always there, and alwaysUp or alwaysDown when the Sun stays above or below the sunrise height all day.
Import it
import type { SunTimes } from "@johnmorrisdotca/wakusei-planets/suncalc";
Definition
type SunTimes = Record<SunTimeName, Date | null> & {
solarNoon: Date;
nadir: Date;
alwaysUp?: boolean;
alwaysDown?: boolean;
[custom: string]: Date | boolean | null | undefined;
};
Members
| Name | Type | Description |
|---|---|---|
sunrise | Date | null | |
sunset | Date | null | |
sunriseEnd | Date | null | |
sunsetStart | Date | null | |
dawn | Date | null | |
dusk | Date | null | |
nauticalDawn | Date | null | |
nauticalDusk | Date | null | |
nightEnd | Date | null | |
night | Date | null | |
goldenHourEnd | Date | null | |
goldenHour | Date | null | |
solarNoon | Date | |
nadir | Date | |
alwaysUp (optional) | boolean | undefined | |
alwaysDown (optional) | boolean | undefined |
Examples
import { getTimes, type SunTimes } from "@johnmorrisdotca/wakusei-planets/suncalc";
const t: SunTimes = getTimes(new Date(Date.UTC(2026, 5, 21, 12)), 51.5, -0.1);
console.log(t.sunrise instanceof Date, t.solarNoon instanceof Date);true trueWhat it prints (run when this page was built)