Weather Station / ECOWITT / DNT
1/**
2 * Type declarations for the 'suncalc' library, which is used for astronomical calculations.
3 */
4declare module 'suncalc' {
5 /**
6 * Represents the various sun times for a given day at a specific location.
7 */
8 export type SunTimes = {
9 sunrise?: Date;
10 sunset?: Date;
11 [k: string]: Date | undefined;
12 };
13
14 /**
15 * Represents the moon rise and set times.
16 */
17 export type MoonTimes = {
18 rise?: Date;
19 set?: Date;
20 alwaysUp?: boolean;
21 alwaysDown?: boolean;
22 };
23
24 /**
25 * Represents the illumination and phase of the moon.
26 */
27 export type MoonIllumination = {
28 /** Moon phase, from 0 (new moon) to 1 (new moon). */
29 phase: number;
30 /** Illuminated fraction of the moon's disk. */
31 fraction: number;
32 /** Midpoint angle in radians of the illuminated limb of the moon. */
33 angle: number;
34 };
35
36 /**
37 * The main object provided by the suncalc library.
38 */
39 const SunCalc: {
40 /** Calculates sun times for a given date and location. */
41 getTimes(date: Date, lat: number, lon: number): SunTimes;
42 /** Calculates moon times for a given date and location. */
43 getMoonTimes(date: Date, lat: number, lon: number, inUtc?: boolean): MoonTimes;
44 /** Calculates moon illumination data for a given date. */
45 getMoonIllumination(date: Date): MoonIllumination;
46 };
47
48 export default SunCalc;
49}