natural-time-js 1.0.4 → 1.0.5
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/context.js +8 -0
- package/index.js +2 -2
- package/package.json +1 -1
package/context.js
CHANGED
|
@@ -154,10 +154,18 @@ export function MustachesRange(naturalDate, latitude) {
|
|
|
154
154
|
let winterSolsticeSunEvents = NaturalSunEvents(new NaturalDate(currentSeasons.dec_solstice.date, 0), latitude);
|
|
155
155
|
let summerSolsticeSunEvents = NaturalSunEvents(new NaturalDate(currentSeasons.jun_solstice.date, 0), latitude);
|
|
156
156
|
|
|
157
|
+
// Calculate average mustache angle from 90° and 270° (usefull for farnorth and farsouth locations where mustaches become unsymetric)
|
|
158
|
+
let averageMustacheAngle = latitude >= 0 ?
|
|
159
|
+
(winterSolsticeSunEvents.sunrise - summerSolsticeSunEvents.sunrise + summerSolsticeSunEvents.sunset - winterSolsticeSunEvents.sunset) / 4 :
|
|
160
|
+
(summerSolsticeSunEvents.sunrise - winterSolsticeSunEvents.sunrise + winterSolsticeSunEvents.sunset - summerSolsticeSunEvents.sunset) / 4;
|
|
161
|
+
|
|
162
|
+
averageMustacheAngle = Math.min(Math.max(averageMustacheAngle, 0), 90);
|
|
163
|
+
|
|
157
164
|
return ASTRO_CACHE[cache_id] = {
|
|
158
165
|
winterSunrise: winterSolsticeSunEvents.sunrise,
|
|
159
166
|
winterSunset: winterSolsticeSunEvents.sunset,
|
|
160
167
|
summerSunrise: summerSolsticeSunEvents.sunrise,
|
|
161
168
|
summerSunset: summerSolsticeSunEvents.sunset,
|
|
169
|
+
averageMustacheAngle: averageMustacheAngle
|
|
162
170
|
};
|
|
163
171
|
}
|
package/index.js
CHANGED
|
@@ -53,9 +53,9 @@ export class NaturalDate {
|
|
|
53
53
|
*/
|
|
54
54
|
constructor(date, longitude) {
|
|
55
55
|
|
|
56
|
-
date = new Date(date);
|
|
56
|
+
date = new Date(date || Date.now());
|
|
57
57
|
this.unixTime = date.getTime();
|
|
58
|
-
this.longitude = longitude;
|
|
58
|
+
this.longitude = longitude || 0;
|
|
59
59
|
|
|
60
60
|
if (Number.isFinite(this.unixTime)) {
|
|
61
61
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "natural-time-js",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "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 translates gregorian artificial datetime to natural datetime",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|