natural-time-js 1.1.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/README.md +99 -107
- package/babel.config.cjs +9 -0
- package/dist/astronomy/celestial.d.ts +104 -0
- package/{context.js → dist/astronomy/celestial.js} +99 -176
- package/dist/astronomy/celestial.js.map +1 -0
- package/dist/core/NaturalDate.d.ts +164 -0
- package/dist/core/NaturalDate.js +254 -0
- package/dist/core/NaturalDate.js.map +1 -0
- package/dist/index.d.ts +74 -0
- package/dist/index.js +76 -0
- package/dist/index.js.map +1 -0
- package/dist/types/index.d.ts +118 -0
- package/dist/types/index.js +12 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/validators.d.ts +140 -0
- package/dist/utils/validators.js +231 -0
- package/dist/utils/validators.js.map +1 -0
- package/jest.config.cjs +29 -0
- package/package.json +23 -3
- package/.github/natural-time-app.jpg +0 -0
- package/index.js +0 -241
- package/utils/validators.js +0 -136
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module natural-time-js/core
|
|
3
|
+
* @description This module provides the core NaturalDate class that bridges between artificial Gregorian time and Natural Time.
|
|
4
|
+
*/
|
|
5
|
+
import { Seasons } from 'astronomy-engine';
|
|
6
|
+
/**
|
|
7
|
+
* Cache for year context calculations to improve performance
|
|
8
|
+
* @private
|
|
9
|
+
*/
|
|
10
|
+
const yearContextCache = new Map();
|
|
11
|
+
/**
|
|
12
|
+
* Calculates year context for natural date calculations.
|
|
13
|
+
*
|
|
14
|
+
* The year context includes:
|
|
15
|
+
* - The start timestamp of the natural year (winter solstice)
|
|
16
|
+
* - The duration of the year in days (365 or 366)
|
|
17
|
+
*
|
|
18
|
+
* This function handles the conversion between Gregorian calendar years
|
|
19
|
+
* and natural years, accounting for longitude adjustments.
|
|
20
|
+
*
|
|
21
|
+
* @param artificialYear - Gregorian calendar year
|
|
22
|
+
* @param longitude - Longitude in degrees (-180 to 180)
|
|
23
|
+
* @returns Year context object with start timestamp and duration
|
|
24
|
+
* @private
|
|
25
|
+
*/
|
|
26
|
+
const calculateYearContext = (artificialYear, longitude) => {
|
|
27
|
+
const cacheKey = `${artificialYear}_${longitude}`;
|
|
28
|
+
if (yearContextCache.has(cacheKey)) {
|
|
29
|
+
return yearContextCache.get(cacheKey);
|
|
30
|
+
}
|
|
31
|
+
const startSolstice = Seasons(artificialYear).dec_solstice.date;
|
|
32
|
+
const endSolstice = Seasons(artificialYear + 1).dec_solstice.date;
|
|
33
|
+
const startNewYear = Date.UTC(startSolstice.getUTCFullYear(), startSolstice.getUTCMonth(), startSolstice.getUTCDate() + (startSolstice.getUTCHours() >= 12 ? 1 : 0), 12, 0, 0);
|
|
34
|
+
const endNewYear = Date.UTC(endSolstice.getUTCFullYear(), endSolstice.getUTCMonth(), endSolstice.getUTCDate() + (endSolstice.getUTCHours() >= 12 ? 1 : 0), 12, 0, 0);
|
|
35
|
+
const context = {
|
|
36
|
+
start: parseInt(String(startNewYear + (-longitude + 180) * NaturalDate.MILLISECONDS_PER_DAY / 360)),
|
|
37
|
+
duration: (endNewYear - startNewYear) / NaturalDate.MILLISECONDS_PER_DAY
|
|
38
|
+
};
|
|
39
|
+
yearContextCache.set(cacheKey, context);
|
|
40
|
+
return context;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Natural date class for converting artificial (Gregorian) dates to natural time.
|
|
44
|
+
*
|
|
45
|
+
* The NaturalDate class provides a complete implementation of the natural time system,
|
|
46
|
+
* which is based on natural cycles:
|
|
47
|
+
* - Years begin at the winter solstice
|
|
48
|
+
* - Each year has 13 moons (months) of 28 days each, plus 1-2 "rainbow days"
|
|
49
|
+
* - Weeks are 7 days
|
|
50
|
+
* - Time is measured in 360 degrees for a full day cycle
|
|
51
|
+
*
|
|
52
|
+
* This class handles the conversion between Gregorian calendar dates and natural time,
|
|
53
|
+
* accounting for longitude adjustments to provide location-specific natural time.
|
|
54
|
+
*/
|
|
55
|
+
export class NaturalDate {
|
|
56
|
+
/**
|
|
57
|
+
* Creates a new natural date instance.
|
|
58
|
+
*
|
|
59
|
+
* Converts a Gregorian date to natural time based on the specified longitude.
|
|
60
|
+
* The longitude is used to adjust the natural time for the local position on Earth.
|
|
61
|
+
*
|
|
62
|
+
* @param date - JavaScript Date object, Unix timestamp, or date string
|
|
63
|
+
* @param longitude - Longitude in degrees (-180 to 180)
|
|
64
|
+
* @throws {Error} If inputs are invalid
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* // Create a natural date for the current time in Paris (longitude 2.3522)
|
|
68
|
+
* const parisNaturalDate = new NaturalDate(new Date(), 2.3522);
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* // Create a natural date for a specific time in Tokyo (longitude 139.6503)
|
|
72
|
+
* const tokyoNaturalDate = new NaturalDate('2023-06-21T12:00:00', 139.6503);
|
|
73
|
+
*/
|
|
74
|
+
constructor(date, longitude) {
|
|
75
|
+
// Validate longitude
|
|
76
|
+
if (longitude !== undefined && (typeof longitude !== 'number' || longitude < -180 || longitude > 180)) {
|
|
77
|
+
throw new Error('Longitude must be between -180 and +180');
|
|
78
|
+
}
|
|
79
|
+
const dateObj = new Date(date || Date.now());
|
|
80
|
+
if (isNaN(dateObj.getTime())) {
|
|
81
|
+
throw new Error('Invalid date provided');
|
|
82
|
+
}
|
|
83
|
+
this.unixTime = dateObj.getTime();
|
|
84
|
+
this.longitude = longitude || 0;
|
|
85
|
+
if (Number.isFinite(this.unixTime)) {
|
|
86
|
+
// YEAR START & DURATION
|
|
87
|
+
let yearContext = calculateYearContext(dateObj.getUTCFullYear() - 1, this.longitude);
|
|
88
|
+
// Correction if between the beginning of natural year and the end of the artificial year
|
|
89
|
+
if (this.unixTime - yearContext.start >= yearContext.duration * NaturalDate.MILLISECONDS_PER_DAY)
|
|
90
|
+
yearContext = calculateYearContext(dateObj.getUTCFullYear(), this.longitude);
|
|
91
|
+
this.yearStart = yearContext.start;
|
|
92
|
+
this.yearDuration = yearContext.duration;
|
|
93
|
+
const timeSinceLocalYearStart = (this.unixTime - this.yearStart) / NaturalDate.MILLISECONDS_PER_DAY;
|
|
94
|
+
// YEAR
|
|
95
|
+
this.year = new Date(this.yearStart).getUTCFullYear() - new Date(NaturalDate.END_OF_ARTIFICIAL_TIME).getUTCFullYear() + 1;
|
|
96
|
+
// MOON
|
|
97
|
+
this.moon = Math.floor(timeSinceLocalYearStart / 28) + 1;
|
|
98
|
+
// HEPTAD
|
|
99
|
+
this.week = Math.floor(timeSinceLocalYearStart / 7) + 1;
|
|
100
|
+
this.weekOfMoon = Math.floor(timeSinceLocalYearStart / 7) % 4 + 1;
|
|
101
|
+
// DAY
|
|
102
|
+
this.day = Math.floor((this.unixTime - (NaturalDate.END_OF_ARTIFICIAL_TIME + (-this.longitude + 180) * NaturalDate.MILLISECONDS_PER_DAY / 360)) / NaturalDate.MILLISECONDS_PER_DAY);
|
|
103
|
+
this.dayOfYear = Math.floor(timeSinceLocalYearStart) + 1;
|
|
104
|
+
this.dayOfMoon = Math.floor(timeSinceLocalYearStart) % 28 + 1;
|
|
105
|
+
this.dayOfWeek = Math.floor(timeSinceLocalYearStart) % 7 + 1;
|
|
106
|
+
// NADIR (i.e day start, midnight)
|
|
107
|
+
this.nadir = this.yearStart + Math.floor(timeSinceLocalYearStart) * NaturalDate.MILLISECONDS_PER_DAY;
|
|
108
|
+
// TIME
|
|
109
|
+
this.time = (this.unixTime - this.nadir) * 360 / NaturalDate.MILLISECONDS_PER_DAY;
|
|
110
|
+
// RAINBOW DAY
|
|
111
|
+
this.isRainbowDay = this.dayOfYear > 13 * 28;
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
throw new Error('Argument must be a Date object or a Unix timestamp');
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Gets the time of an astronomical event in natural degrees.
|
|
118
|
+
*
|
|
119
|
+
* Converts an event timestamp to natural degrees (0-360°) within the current natural day.
|
|
120
|
+
* Returns false if the event occurs outside the current natural day.
|
|
121
|
+
*
|
|
122
|
+
* This is useful for calculating the position of celestial events like sunrise, sunset,
|
|
123
|
+
* moonrise, or moonset within the natural time system.
|
|
124
|
+
*
|
|
125
|
+
* @param event - Event timestamp (Date object, Unix timestamp, or date string)
|
|
126
|
+
* @returns Event time in natural degrees (0-360°) or false if out of range
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* // Calculate sunrise time in natural degrees
|
|
130
|
+
* const naturalDate = new NaturalDate(new Date(), 0);
|
|
131
|
+
* const sunrise = '2023-01-01T06:00:00'; // Example sunrise at 6:00 AM
|
|
132
|
+
* const sunriseInDegrees = naturalDate.getTimeOfEvent(sunrise);
|
|
133
|
+
* console.log(`Sunrise occurs at ${sunriseInDegrees}°`);
|
|
134
|
+
*/
|
|
135
|
+
getTimeOfEvent(event) {
|
|
136
|
+
// Make sure it's a unix timestamp
|
|
137
|
+
const eventTime = new Date(event).getTime();
|
|
138
|
+
// Check if not out of range
|
|
139
|
+
if (eventTime < this.nadir || eventTime > this.nadir + NaturalDate.MILLISECONDS_PER_DAY)
|
|
140
|
+
return false;
|
|
141
|
+
return (eventTime - this.nadir) * (360 / NaturalDate.MILLISECONDS_PER_DAY);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Exports current date as a full ISO formatted string.
|
|
145
|
+
*
|
|
146
|
+
* The format is: "YYY)MM)DD TTT°DD NT±LLL.L"
|
|
147
|
+
* - YYY: Natural year (padded to 3 digits)
|
|
148
|
+
* - MM: Moon number (padded to 2 digits)
|
|
149
|
+
* - DD: Day of moon (padded to 2 digits)
|
|
150
|
+
* - TTT: Time in degrees (padded to 3 digits)
|
|
151
|
+
* - DD: Decimal degrees (2 digits)
|
|
152
|
+
* - ±LLL.L: Longitude with sign and 1 decimal
|
|
153
|
+
*
|
|
154
|
+
* @returns {string} Formatted natural date string
|
|
155
|
+
*/
|
|
156
|
+
toString() {
|
|
157
|
+
return `${this.toDateString()} ${this.toTimeString()} ${this.toLongitudeString()}`;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Exports the date part of the natural date.
|
|
161
|
+
*
|
|
162
|
+
* @param separator - Separator character between components (default: ')')
|
|
163
|
+
* @returns Formatted date string
|
|
164
|
+
*/
|
|
165
|
+
toDateString(separator = ')') {
|
|
166
|
+
if (this.isRainbowDay) {
|
|
167
|
+
const isSecondRainbowDay = this.dayOfYear === 366;
|
|
168
|
+
return `${this.toYearString()}${separator}RAINBOW${isSecondRainbowDay ? '+' : ''}`;
|
|
169
|
+
}
|
|
170
|
+
return `${this.toYearString()}${separator}${this.toMoonString()}${separator}${this.toDayOfMoonString()}`;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Exports the time part of the natural date.
|
|
174
|
+
*
|
|
175
|
+
* @param decimals - Number of decimal places for time (default: 2)
|
|
176
|
+
* @param rounding - Rounding increment for time (default: 1)
|
|
177
|
+
* @returns Formatted time string
|
|
178
|
+
*/
|
|
179
|
+
toTimeString(decimals = 2, rounding = 0.01) {
|
|
180
|
+
let time = this.time;
|
|
181
|
+
// Round to the nearest decimal increment
|
|
182
|
+
if (rounding > 0) {
|
|
183
|
+
time = Math.round(time / rounding) * rounding;
|
|
184
|
+
// Handle edge case where rounding pushes us to 360°
|
|
185
|
+
if (time >= 360) {
|
|
186
|
+
time = 0;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
// Format the integer part to 3 digits
|
|
190
|
+
const integerPart = Math.floor(time).toString().padStart(3, '0');
|
|
191
|
+
// Format the decimal part if needed
|
|
192
|
+
const decimalPart = decimals > 0
|
|
193
|
+
? (time % 1).toFixed(decimals).substring(2).padEnd(decimals, '0')
|
|
194
|
+
: '';
|
|
195
|
+
return `${integerPart}°${decimalPart}`;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Exports the longitude part of the natural date.
|
|
199
|
+
*
|
|
200
|
+
* @param decimals - Number of decimal places for longitude (default: 1)
|
|
201
|
+
* @returns Formatted longitude string
|
|
202
|
+
*/
|
|
203
|
+
toLongitudeString(decimals = 1) {
|
|
204
|
+
// Consider longitudes very close to 0 (within 0.5 degrees) as NTZ
|
|
205
|
+
if (Math.abs(this.longitude) < 0.5) {
|
|
206
|
+
return 'NTZ';
|
|
207
|
+
}
|
|
208
|
+
const prefix = 'NT';
|
|
209
|
+
const sign = this.longitude >= 0 ? '+' : '-';
|
|
210
|
+
const absLongitude = Math.abs(this.longitude);
|
|
211
|
+
const integerPart = Math.floor(absLongitude).toString().padStart(1, '0');
|
|
212
|
+
const decimalPart = decimals > 0
|
|
213
|
+
? (absLongitude % 1).toFixed(decimals).substring(2)
|
|
214
|
+
: '';
|
|
215
|
+
return `${prefix}${sign}${integerPart}${decimals > 0 ? '.' + decimalPart : ''}`;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Exports the year part of the natural date.
|
|
219
|
+
*
|
|
220
|
+
* @returns Formatted year string
|
|
221
|
+
*/
|
|
222
|
+
toYearString() {
|
|
223
|
+
const absYear = Math.abs(this.year);
|
|
224
|
+
const sign = this.year < 0 ? '-' : '';
|
|
225
|
+
return `${sign}${absYear.toString().padStart(3, '0')}`;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Exports the moon part of the natural date.
|
|
229
|
+
*
|
|
230
|
+
* @returns Formatted moon string
|
|
231
|
+
*/
|
|
232
|
+
toMoonString() {
|
|
233
|
+
return this.moon.toString().padStart(2, '0');
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Exports the day of moon part of the natural date.
|
|
237
|
+
*
|
|
238
|
+
* @returns Formatted day of moon string
|
|
239
|
+
*/
|
|
240
|
+
toDayOfMoonString() {
|
|
241
|
+
return this.dayOfMoon.toString().padStart(2, '0');
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Number of milliseconds in a day
|
|
246
|
+
*/
|
|
247
|
+
NaturalDate.MILLISECONDS_PER_DAY = 86400000; // 24 * 60 * 60 * 1000
|
|
248
|
+
/**
|
|
249
|
+
* End date of the artificial time era (December 21, 2012 12:00 UTC)
|
|
250
|
+
* This is the reference point for natural time calculations
|
|
251
|
+
*/
|
|
252
|
+
NaturalDate.END_OF_ARTIFICIAL_TIME = Date.UTC(2012, 11, 21, 12, 0, 0);
|
|
253
|
+
export { yearContextCache };
|
|
254
|
+
//# sourceMappingURL=NaturalDate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NaturalDate.js","sourceRoot":"","sources":["../../src/core/NaturalDate.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAU3C;;;GAGG;AACH,MAAM,gBAAgB,GAA6B,IAAI,GAAG,EAAE,CAAC;AAE7D;;;;;;;;;;;;;;GAcG;AACH,MAAM,oBAAoB,GAAG,CAAC,cAAsB,EAAE,SAAiB,EAAe,EAAE;IACpF,MAAM,QAAQ,GAAG,GAAG,cAAc,IAAI,SAAS,EAAE,CAAC;IAElD,IAAI,gBAAgB,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;QACjC,OAAO,gBAAgB,CAAC,GAAG,CAAC,QAAQ,CAAE,CAAC;IAC3C,CAAC;IAED,MAAM,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC;IAChE,MAAM,WAAW,GAAG,OAAO,CAAC,cAAc,GAAG,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC;IAElE,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CACzB,aAAa,CAAC,cAAc,EAAE,EAC9B,aAAa,CAAC,WAAW,EAAE,EAC3B,aAAa,CAAC,UAAU,EAAE,GAAG,CAAC,aAAa,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EACxE,EA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AC,CAAC,CAAC,GAAG,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IACpF,CAAC;IAED;;;;OAIG;IACH,YAAY;QACR,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACpC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QACtC,OAAO,GAAG,IAAI,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;IAC3D,CAAC;IAED;;;;OAIG;IACH,YAAY;QACR,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACjD,CAAC;IAED;;;;OAIG;IACH,iBAAiB;QACb,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACtD,CAAC;;AAjRD;;GAEG;AACa,gCAAoB,GAAW,QAAQ,CAAC,CAAC,sBAAsB;AAE/E;;;GAGG;AACa,kCAAsB,GAAW,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AA2QtF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module natural-time-js
|
|
3
|
+
* @description Natural time is a fresh, elegant, and coherent way of measuring the movements of time here on the Earth.
|
|
4
|
+
* This new time standard is based on common sense and the observation of natural cycles.
|
|
5
|
+
* Our current Gregorian calendar is an artificial construct disconnected from natural cycles.
|
|
6
|
+
* Natural time realigns us with the observable patterns of the cosmos:
|
|
7
|
+
* It's time to return to the cosmic rhythms that have guided humanity for millennia.
|
|
8
|
+
* Learn more: https://naturaltime.app
|
|
9
|
+
*
|
|
10
|
+
* # Natural Time JavaScript Library
|
|
11
|
+
*
|
|
12
|
+
* This JavaScript library translates Gregorian (artificial) datetime to natural datetime.
|
|
13
|
+
* Natural time is defined by:
|
|
14
|
+
*
|
|
15
|
+
* - 360° circular time - replacing arbitrary hours with continuous movement
|
|
16
|
+
* - Make the sun back as the main source of time
|
|
17
|
+
* - Years beginning at the winter solstice
|
|
18
|
+
* - 13 perfect moons of 28 days = 364 days
|
|
19
|
+
* - "Rainbow day(s)" - Day out of time to make the year 365 or 366 days
|
|
20
|
+
*
|
|
21
|
+
* This is mathematical beauty aligned with astronomical reality.
|
|
22
|
+
*
|
|
23
|
+
* ## Basic Usage
|
|
24
|
+
*
|
|
25
|
+
* ```typescript
|
|
26
|
+
* import { NaturalDate } from 'natural-time-js';
|
|
27
|
+
*
|
|
28
|
+
* // Create a natural date for the current time at longitude 0
|
|
29
|
+
* const naturalDate = new NaturalDate(new Date(), 0);
|
|
30
|
+
*
|
|
31
|
+
* // Display the natural date
|
|
32
|
+
* console.log(naturalDate.toString());
|
|
33
|
+
* // Example output: "011)04)15 113°25 NTZ"
|
|
34
|
+
*
|
|
35
|
+
* // Get specific components
|
|
36
|
+
* console.log(`Year: ${naturalDate.year}`);
|
|
37
|
+
* console.log(`Moon: ${naturalDate.moon}`);
|
|
38
|
+
* console.log(`Day of moon: ${naturalDate.dayOfMoon}`);
|
|
39
|
+
* console.log(`Time: ${naturalDate.time}°`);
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* ## Astronomical Functions
|
|
43
|
+
*
|
|
44
|
+
* The library provides astronomical functions for calculating sun and moon positions:
|
|
45
|
+
*
|
|
46
|
+
* ```typescript
|
|
47
|
+
* import { NaturalDate, NaturalSunEvents, NaturalMoonPosition } from 'natural-time-js';
|
|
48
|
+
*
|
|
49
|
+
* const naturalDate = new NaturalDate(new Date(), 0);
|
|
50
|
+
* const latitude = 45; // 45° North
|
|
51
|
+
*
|
|
52
|
+
* // Get sun events for the day
|
|
53
|
+
* const sunEvents = NaturalSunEvents(naturalDate, latitude);
|
|
54
|
+
* console.log(`Sunrise: ${sunEvents.sunrise}°`);
|
|
55
|
+
* console.log(`Sunset: ${sunEvents.sunset}°`);
|
|
56
|
+
*
|
|
57
|
+
* // Get moon position and phase
|
|
58
|
+
* const moonInfo = NaturalMoonPosition(naturalDate, latitude);
|
|
59
|
+
* console.log(`Moon phase: ${moonInfo.phase}°`);
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @author Sylvain 441
|
|
63
|
+
* @license CC0-1.0
|
|
64
|
+
* @version 1.1.1
|
|
65
|
+
*/
|
|
66
|
+
export { NaturalDate, yearContextCache } from './core/NaturalDate';
|
|
67
|
+
/**
|
|
68
|
+
* Astronomical functions and constants for natural time calculations
|
|
69
|
+
*/
|
|
70
|
+
export { NaturalSunAltitude, NaturalSunEvents, NaturalMoonPosition, NaturalMoonEvents, MustachesRange, HEMISPHERES, SEASONS, ANGLES } from './astronomy/celestial';
|
|
71
|
+
/**
|
|
72
|
+
* Utility functions for validation and error handling
|
|
73
|
+
*/
|
|
74
|
+
export { isValidLatitude, isValidLongitude, isValidAngle, isValidTimestamp, isValidNaturalDate, isValidCacheKey, throwValidationError } from './utils/validators';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module natural-time-js
|
|
3
|
+
* @description Natural time is a fresh, elegant, and coherent way of measuring the movements of time here on the Earth.
|
|
4
|
+
* This new time standard is based on common sense and the observation of natural cycles.
|
|
5
|
+
* Our current Gregorian calendar is an artificial construct disconnected from natural cycles.
|
|
6
|
+
* Natural time realigns us with the observable patterns of the cosmos:
|
|
7
|
+
* It's time to return to the cosmic rhythms that have guided humanity for millennia.
|
|
8
|
+
* Learn more: https://naturaltime.app
|
|
9
|
+
*
|
|
10
|
+
* # Natural Time JavaScript Library
|
|
11
|
+
*
|
|
12
|
+
* This JavaScript library translates Gregorian (artificial) datetime to natural datetime.
|
|
13
|
+
* Natural time is defined by:
|
|
14
|
+
*
|
|
15
|
+
* - 360° circular time - replacing arbitrary hours with continuous movement
|
|
16
|
+
* - Make the sun back as the main source of time
|
|
17
|
+
* - Years beginning at the winter solstice
|
|
18
|
+
* - 13 perfect moons of 28 days = 364 days
|
|
19
|
+
* - "Rainbow day(s)" - Day out of time to make the year 365 or 366 days
|
|
20
|
+
*
|
|
21
|
+
* This is mathematical beauty aligned with astronomical reality.
|
|
22
|
+
*
|
|
23
|
+
* ## Basic Usage
|
|
24
|
+
*
|
|
25
|
+
* ```typescript
|
|
26
|
+
* import { NaturalDate } from 'natural-time-js';
|
|
27
|
+
*
|
|
28
|
+
* // Create a natural date for the current time at longitude 0
|
|
29
|
+
* const naturalDate = new NaturalDate(new Date(), 0);
|
|
30
|
+
*
|
|
31
|
+
* // Display the natural date
|
|
32
|
+
* console.log(naturalDate.toString());
|
|
33
|
+
* // Example output: "011)04)15 113°25 NTZ"
|
|
34
|
+
*
|
|
35
|
+
* // Get specific components
|
|
36
|
+
* console.log(`Year: ${naturalDate.year}`);
|
|
37
|
+
* console.log(`Moon: ${naturalDate.moon}`);
|
|
38
|
+
* console.log(`Day of moon: ${naturalDate.dayOfMoon}`);
|
|
39
|
+
* console.log(`Time: ${naturalDate.time}°`);
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* ## Astronomical Functions
|
|
43
|
+
*
|
|
44
|
+
* The library provides astronomical functions for calculating sun and moon positions:
|
|
45
|
+
*
|
|
46
|
+
* ```typescript
|
|
47
|
+
* import { NaturalDate, NaturalSunEvents, NaturalMoonPosition } from 'natural-time-js';
|
|
48
|
+
*
|
|
49
|
+
* const naturalDate = new NaturalDate(new Date(), 0);
|
|
50
|
+
* const latitude = 45; // 45° North
|
|
51
|
+
*
|
|
52
|
+
* // Get sun events for the day
|
|
53
|
+
* const sunEvents = NaturalSunEvents(naturalDate, latitude);
|
|
54
|
+
* console.log(`Sunrise: ${sunEvents.sunrise}°`);
|
|
55
|
+
* console.log(`Sunset: ${sunEvents.sunset}°`);
|
|
56
|
+
*
|
|
57
|
+
* // Get moon position and phase
|
|
58
|
+
* const moonInfo = NaturalMoonPosition(naturalDate, latitude);
|
|
59
|
+
* console.log(`Moon phase: ${moonInfo.phase}°`);
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @author Sylvain 441
|
|
63
|
+
* @license CC0-1.0
|
|
64
|
+
* @version 1.1.1
|
|
65
|
+
*/
|
|
66
|
+
// Export the core NaturalDate class
|
|
67
|
+
export { NaturalDate, yearContextCache } from './core/NaturalDate';
|
|
68
|
+
/**
|
|
69
|
+
* Astronomical functions and constants for natural time calculations
|
|
70
|
+
*/
|
|
71
|
+
export { NaturalSunAltitude, NaturalSunEvents, NaturalMoonPosition, NaturalMoonEvents, MustachesRange, HEMISPHERES, SEASONS, ANGLES } from './astronomy/celestial';
|
|
72
|
+
/**
|
|
73
|
+
* Utility functions for validation and error handling
|
|
74
|
+
*/
|
|
75
|
+
export { isValidLatitude, isValidLongitude, isValidAngle, isValidTimestamp, isValidNaturalDate, isValidCacheKey, throwValidationError } from './utils/validators';
|
|
76
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AAEH,oCAAoC;AACpC,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEnE;;GAEG;AACH,OAAO,EACH,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,WAAW,EACX,OAAO,EACP,MAAM,EACT,MAAM,uBAAuB,CAAC;AAE/B;;GAEG;AACH,OAAO,EACH,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,oBAAoB,EACvB,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for natural-time-js
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Interface for NaturalDate class to avoid circular dependencies
|
|
6
|
+
*/
|
|
7
|
+
export interface INaturalDate {
|
|
8
|
+
/** Artificial gregorian date (UNIX timestamp) */
|
|
9
|
+
unixTime: number;
|
|
10
|
+
/** Longitude in degrees (-180 to 180) */
|
|
11
|
+
longitude: number;
|
|
12
|
+
/** Current year (year 1: 2012/2013) */
|
|
13
|
+
year: number;
|
|
14
|
+
/** Current moon (between 1 and 14) */
|
|
15
|
+
moon: number;
|
|
16
|
+
/** Current week (between 1 and 53) */
|
|
17
|
+
week: number;
|
|
18
|
+
/** Current week of the moon (between 1 and 4) */
|
|
19
|
+
weekOfMoon: number;
|
|
20
|
+
/** Number of days passed since END_OF_ARTIFICIAL_TIME */
|
|
21
|
+
day: number;
|
|
22
|
+
/** Current day of the year (between 1 and 366) */
|
|
23
|
+
dayOfYear: number;
|
|
24
|
+
/** Current day of the moon (between 1 and 28) */
|
|
25
|
+
dayOfMoon: number;
|
|
26
|
+
/** Current day of the week (between 1 and 7) */
|
|
27
|
+
dayOfWeek: number;
|
|
28
|
+
/** True if current day is rainbow day */
|
|
29
|
+
isRainbowDay: boolean;
|
|
30
|
+
/** Current time (between 0 and 359.999...) */
|
|
31
|
+
time: number;
|
|
32
|
+
/** Beginning of the year at the current longitude (UNIX timestamp) */
|
|
33
|
+
yearStart: number;
|
|
34
|
+
/** Numbers of days in the current year (between 365 and 366) */
|
|
35
|
+
yearDuration: number;
|
|
36
|
+
/** Beginning of the day at the current longitude (UNIX timestamp) */
|
|
37
|
+
nadir: number;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Year context for natural date calculations
|
|
41
|
+
*/
|
|
42
|
+
export interface YearContext {
|
|
43
|
+
/** Start timestamp of the year */
|
|
44
|
+
start: number;
|
|
45
|
+
/** Duration of the year in days */
|
|
46
|
+
duration: number;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Sun altitude information
|
|
50
|
+
*/
|
|
51
|
+
export interface SunAltitude {
|
|
52
|
+
/** Current altitude of the sun in degrees */
|
|
53
|
+
altitude: number;
|
|
54
|
+
/** Highest altitude the sun will reach on this day */
|
|
55
|
+
highestAltitude: number;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Sun events throughout the day
|
|
59
|
+
*/
|
|
60
|
+
export interface SunEvents {
|
|
61
|
+
/** Time of sunrise in degrees (0-360) or false if no sunrise */
|
|
62
|
+
sunrise: number | false;
|
|
63
|
+
/** Time of sunset in degrees (0-360) or false if no sunset */
|
|
64
|
+
sunset: number | false;
|
|
65
|
+
/** Time when night starts in degrees (0-360) or false if no night start */
|
|
66
|
+
nightStart: number | false;
|
|
67
|
+
/** Time when night ends in degrees (0-360) or false if no night end */
|
|
68
|
+
nightEnd: number | false;
|
|
69
|
+
/** Time when morning golden hour starts in degrees (0-360) or false if no morning golden hour */
|
|
70
|
+
morningGoldenHour: number | false;
|
|
71
|
+
/** Time when evening golden hour starts in degrees (0-360) or false if no evening golden hour */
|
|
72
|
+
eveningGoldenHour: number | false;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Moon position information
|
|
76
|
+
*/
|
|
77
|
+
export interface MoonPosition {
|
|
78
|
+
/** Moon phase in degrees (0-360) */
|
|
79
|
+
phase: number;
|
|
80
|
+
/** Current altitude of the moon in degrees */
|
|
81
|
+
altitude: number;
|
|
82
|
+
/** Highest altitude the moon will reach on this day */
|
|
83
|
+
highestAltitude: number;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Moon events throughout the day
|
|
87
|
+
*/
|
|
88
|
+
export interface MoonEvents {
|
|
89
|
+
/** Time of moonrise in degrees (0-360) or false if no moonrise */
|
|
90
|
+
moonrise: number | false;
|
|
91
|
+
/** Time of moonset in degrees (0-360) or false if no moonset */
|
|
92
|
+
moonset: number | false;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Hemisphere identifiers
|
|
96
|
+
*/
|
|
97
|
+
export declare enum Hemisphere {
|
|
98
|
+
NORTH = "NORTH",
|
|
99
|
+
SOUTH = "SOUTH"
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Season day markers
|
|
103
|
+
*/
|
|
104
|
+
export interface Seasons {
|
|
105
|
+
/** Day 91 (typically April 1st) */
|
|
106
|
+
SUMMER_START_DAY: number;
|
|
107
|
+
/** Day 273 (typically September 30th) */
|
|
108
|
+
SUMMER_END_DAY: number;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Solar altitude thresholds
|
|
112
|
+
*/
|
|
113
|
+
export interface Angles {
|
|
114
|
+
/** Night altitude threshold in degrees */
|
|
115
|
+
NIGHT_ALTITUDE: number;
|
|
116
|
+
/** Golden hour altitude threshold in degrees */
|
|
117
|
+
GOLDEN_HOUR_ALTITUDE: number;
|
|
118
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for natural-time-js
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Hemisphere identifiers
|
|
6
|
+
*/
|
|
7
|
+
export var Hemisphere;
|
|
8
|
+
(function (Hemisphere) {
|
|
9
|
+
Hemisphere["NORTH"] = "NORTH";
|
|
10
|
+
Hemisphere["SOUTH"] = "SOUTH";
|
|
11
|
+
})(Hemisphere || (Hemisphere = {}));
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAkGH;;GAEG;AACH,MAAM,CAAN,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,6BAAe,CAAA;IACf,6BAAe,CAAA;AACjB,CAAC,EAHW,UAAU,KAAV,UAAU,QAGrB"}
|