UNPKG

natural-time-js

Version:

Natural time is a fresh, elegant, and coherent way of measuring the movements of time here on the Earth. This new time standard is based on common sense and the observation of natural cycles. Learn more: https://naturaltime.app. This JavaScript Class tran

119 lines (118 loc) 3.61 kB
/** * Type definitions for natural-time-js */ /** * Interface for NaturalDate class to avoid circular dependencies */ export interface INaturalDate { /** Artificial gregorian date (UNIX timestamp) */ unixTime: number; /** Longitude in degrees (-180 to 180) */ longitude: number; /** Current year (year 1: 2012/2013) */ year: number; /** Current moon (between 1 and 14) */ moon: number; /** Current week (between 1 and 53) */ week: number; /** Current week of the moon (between 1 and 4) */ weekOfMoon: number; /** Number of days passed since END_OF_ARTIFICIAL_TIME */ day: number; /** Current day of the year (between 1 and 366) */ dayOfYear: number; /** Current day of the moon (between 1 and 28) */ dayOfMoon: number; /** Current day of the week (between 1 and 7) */ dayOfWeek: number; /** True if current day is rainbow day */ isRainbowDay: boolean; /** Current time (between 0 and 359.999...) */ time: number; /** Beginning of the year at the current longitude (UNIX timestamp) */ yearStart: number; /** Numbers of days in the current year (between 365 and 366) */ yearDuration: number; /** Beginning of the day at the current longitude (UNIX timestamp) */ nadir: number; } /** * Year context for natural date calculations */ export interface YearContext { /** Start timestamp of the year */ start: number; /** Duration of the year in days */ duration: number; } /** * Sun altitude information */ export interface SunAltitude { /** Current altitude of the sun in degrees */ altitude: number; /** Highest altitude the sun will reach on this day */ highestAltitude: number; } /** * Sun events throughout the day */ export interface SunEvents { /** Time of sunrise in degrees (0-360) or false if no sunrise */ sunrise: number | false; /** Time of sunset in degrees (0-360) or false if no sunset */ sunset: number | false; /** Time when night starts in degrees (0-360) or false if no night start */ nightStart: number | false; /** Time when night ends in degrees (0-360) or false if no night end */ nightEnd: number | false; /** Time when morning golden hour starts in degrees (0-360) or false if no morning golden hour */ morningGoldenHour: number | false; /** Time when evening golden hour starts in degrees (0-360) or false if no evening golden hour */ eveningGoldenHour: number | false; } /** * Moon position information */ export interface MoonPosition { /** Moon phase in degrees (0-360) */ phase: number; /** Current altitude of the moon in degrees */ altitude: number; /** Highest altitude the moon will reach on this day */ highestAltitude: number; } /** * Moon events throughout the day */ export interface MoonEvents { /** Time of moonrise in degrees (0-360) or false if no moonrise */ moonrise: number | false; /** Time of moonset in degrees (0-360) or false if no moonset */ moonset: number | false; } /** * Hemisphere identifiers */ export declare enum Hemisphere { NORTH = "NORTH", SOUTH = "SOUTH" } /** * Season day markers */ export interface Seasons { /** Day 91 (typically April 1st) */ SUMMER_START_DAY: number; /** Day 273 (typically September 30th) */ SUMMER_END_DAY: number; } /** * Solar altitude thresholds */ export interface Angles { /** Night altitude threshold in degrees */ NIGHT_ALTITUDE: number; /** Golden hour altitude threshold in degrees */ GOLDEN_HOUR_ALTITUDE: number; }