@hebcal/core 5.0.0-rc4 → 5.0.0-rc5
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/dist/bundle.js +212 -282
- package/dist/bundle.min.js +2 -2
- package/dist/index.js +211 -261
- package/dist/index.mjs +210 -262
- package/hebcal.d.ts +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
/*! @hebcal/core v5.0.0-
|
|
1
|
+
/*! @hebcal/core v5.0.0-rc5 */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
+
var temporalPolyfill = require('temporal-polyfill');
|
|
5
|
+
|
|
4
6
|
const GERESH = '׳';
|
|
5
7
|
const GERSHAYIM = '״';
|
|
6
8
|
const heb2num = {
|
|
@@ -940,46 +942,6 @@ function toSimpleHebrewDate(obj) {
|
|
|
940
942
|
throw new TypeError(`Argument not a Date: ${obj}`);
|
|
941
943
|
}
|
|
942
944
|
}
|
|
943
|
-
/**
|
|
944
|
-
* Calculates yahrzeit.
|
|
945
|
-
* `hyear` must be after original `date` of death.
|
|
946
|
-
* Returns `undefined` when requested year preceeds or is same as original year.
|
|
947
|
-
*
|
|
948
|
-
* Hebcal uses the algorithm defined in "Calendrical Calculations"
|
|
949
|
-
* by Edward M. Reingold and Nachum Dershowitz.
|
|
950
|
-
*
|
|
951
|
-
* The customary anniversary date of a death is more complicated and depends
|
|
952
|
-
* also on the character of the year in which the first anniversary occurs.
|
|
953
|
-
* There are several cases:
|
|
954
|
-
*
|
|
955
|
-
* * If the date of death is Marcheshvan 30, the anniversary in general depends
|
|
956
|
-
* on the first anniversary; if that first anniversary was not Marcheshvan 30,
|
|
957
|
-
* use the day before Kislev 1.
|
|
958
|
-
* * If the date of death is Kislev 30, the anniversary in general again depends
|
|
959
|
-
* on the first anniversary — if that was not Kislev 30, use the day before
|
|
960
|
-
* Tevet 1.
|
|
961
|
-
* * If the date of death is Adar II, the anniversary is the same day in the
|
|
962
|
-
* last month of the Hebrew year (Adar or Adar II).
|
|
963
|
-
* * If the date of death is Adar I 30, the anniversary in a Hebrew year that
|
|
964
|
-
* is not a leap year (in which Adar only has 29 days) is the last day in
|
|
965
|
-
* Shevat.
|
|
966
|
-
* * In all other cases, use the normal (that is, same month number) anniversary
|
|
967
|
-
* of the date of death. [Calendrical Calculations p. 113]
|
|
968
|
-
* @example
|
|
969
|
-
* import {getYahrzeit} from '@hebcal/hdate';
|
|
970
|
-
* const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
|
|
971
|
-
* const anniversary = getYahrzeit(5780, dt); // '2/25/2020' == '30 Sh\'vat 5780'
|
|
972
|
-
* @param {number} hyear Hebrew year
|
|
973
|
-
* @param {Date | SimpleHebrewDate | number} date Gregorian or Hebrew date of death
|
|
974
|
-
* @return {Date} anniversary occurring in `hyear`
|
|
975
|
-
*/
|
|
976
|
-
function getYahrzeit(hyear, date) {
|
|
977
|
-
const hd = getYahrzeitHD(hyear, date);
|
|
978
|
-
if (typeof hd === 'undefined') {
|
|
979
|
-
return hd;
|
|
980
|
-
}
|
|
981
|
-
return exports.greg.abs2greg(hebrew2abs(hd.yy, hd.mm, hd.dd));
|
|
982
|
-
}
|
|
983
945
|
function getYahrzeitHD(hyear, date) {
|
|
984
946
|
let hDeath = toSimpleHebrewDate(date);
|
|
985
947
|
if (hyear <= hDeath.yy) {
|
|
@@ -1019,38 +981,6 @@ function getYahrzeitHD(hyear, date) {
|
|
|
1019
981
|
hDeath.yy = hyear;
|
|
1020
982
|
return hDeath;
|
|
1021
983
|
}
|
|
1022
|
-
/**
|
|
1023
|
-
* Calculates a birthday or anniversary (non-yahrzeit).
|
|
1024
|
-
* `hyear` must be after original `date` of anniversary.
|
|
1025
|
-
* Returns `undefined` when requested year preceeds or is same as original year.
|
|
1026
|
-
*
|
|
1027
|
-
* Hebcal uses the algorithm defined in "Calendrical Calculations"
|
|
1028
|
-
* by Edward M. Reingold and Nachum Dershowitz.
|
|
1029
|
-
*
|
|
1030
|
-
* The birthday of someone born in Adar of an ordinary year or Adar II of
|
|
1031
|
-
* a leap year is also always in the last month of the year, be that Adar
|
|
1032
|
-
* or Adar II. The birthday in an ordinary year of someone born during the
|
|
1033
|
-
* first 29 days of Adar I in a leap year is on the corresponding day of Adar;
|
|
1034
|
-
* in a leap year, the birthday occurs in Adar I, as expected.
|
|
1035
|
-
*
|
|
1036
|
-
* Someone born on the thirtieth day of Marcheshvan, Kislev, or Adar I
|
|
1037
|
-
* has his birthday postponed until the first of the following month in
|
|
1038
|
-
* years where that day does not occur. [Calendrical Calculations p. 111]
|
|
1039
|
-
* @example
|
|
1040
|
-
* import {getBirthdayOrAnniversary} from '@hebcal/hdate';
|
|
1041
|
-
* const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
|
|
1042
|
-
* const anniversary = getBirthdayOrAnniversary(5780, dt); // '3/26/2020' == '1 Nisan 5780'
|
|
1043
|
-
* @param {number} hyear Hebrew year
|
|
1044
|
-
* @param {Date | SimpleHebrewDate | number} date Gregorian or Hebrew date of event
|
|
1045
|
-
* @return {Date} anniversary occurring in `hyear`
|
|
1046
|
-
*/
|
|
1047
|
-
function getBirthdayOrAnniversary(hyear, date) {
|
|
1048
|
-
const hd = getBirthdayHD(hyear, date);
|
|
1049
|
-
if (typeof hd === 'undefined') {
|
|
1050
|
-
return hd;
|
|
1051
|
-
}
|
|
1052
|
-
return exports.greg.abs2greg(hebrew2abs(hd.yy, hd.mm, hd.dd));
|
|
1053
|
-
}
|
|
1054
984
|
function getBirthdayHD(hyear, date) {
|
|
1055
985
|
const orig = toSimpleHebrewDate(date);
|
|
1056
986
|
const origYear = orig.yy;
|
|
@@ -1201,11 +1131,11 @@ class HDate {
|
|
|
1201
1131
|
this.setDate(day);
|
|
1202
1132
|
} else {
|
|
1203
1133
|
// 0 arguments
|
|
1204
|
-
if (typeof day === 'undefined') {
|
|
1134
|
+
if (typeof day === 'undefined' || day === null) {
|
|
1205
1135
|
day = new Date();
|
|
1206
1136
|
}
|
|
1207
1137
|
// 1 argument
|
|
1208
|
-
const abs0 = typeof day === 'number' && !isNaN(day) ? day : exports.greg.isDate(day) ? exports.greg.greg2abs(day) :
|
|
1138
|
+
const abs0 = typeof day === 'number' && !isNaN(day) ? day : exports.greg.isDate(day) ? exports.greg.greg2abs(day) : typeof day.yy === 'number' && typeof day.mm === 'number' && typeof day.dd === 'number' ? day : throwTypeError(`HDate called with bad argument: ${day}`);
|
|
1209
1139
|
const isNumber = typeof abs0 === 'number';
|
|
1210
1140
|
const d = isNumber ? abs2hebrew(abs0) : abs0;
|
|
1211
1141
|
/**
|
|
@@ -2114,26 +2044,6 @@ class HebrewDateEvent extends Event {
|
|
|
2114
2044
|
}
|
|
2115
2045
|
}
|
|
2116
2046
|
|
|
2117
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
2118
|
-
|
|
2119
|
-
var esm = {};
|
|
2120
|
-
|
|
2121
|
-
var __awaiter = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2122
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
2123
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
2124
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
2125
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
2126
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
2127
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
2128
|
-
});
|
|
2129
|
-
};
|
|
2130
|
-
Object.defineProperty(esm, "__esModule", { value: true });
|
|
2131
|
-
exports.NOAACalculator = esm.NOAACalculator = exports.GeoLocation = esm.GeoLocation = void 0;
|
|
2132
|
-
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
2133
|
-
if (typeof Temporal !== 'function') {
|
|
2134
|
-
yield Promise.resolve().then(function () { return global$1; });
|
|
2135
|
-
}
|
|
2136
|
-
}))();
|
|
2137
2047
|
/**
|
|
2138
2048
|
* java.lang.Math.toRadians
|
|
2139
2049
|
* @private
|
|
@@ -2150,12 +2060,9 @@ function degreesToRadians(degrees) {
|
|
|
2150
2060
|
function radiansToDegrees(radians) {
|
|
2151
2061
|
return (radians * 180) / Math.PI;
|
|
2152
2062
|
}
|
|
2153
|
-
const Long_MIN_VALUE = NaN;
|
|
2154
2063
|
/**
|
|
2155
2064
|
* A class that contains location information such as latitude and longitude required for astronomical calculations. The
|
|
2156
|
-
* elevation field may not be used by some calculation engines and would be ignored if set.
|
|
2157
|
-
* specific implementations of the {@link AstronomicalCalculator} to see if elevation is calculated as part of the
|
|
2158
|
-
* algorithm.
|
|
2065
|
+
* elevation field may not be used by some calculation engines and would be ignored if set.
|
|
2159
2066
|
*
|
|
2160
2067
|
* @author © Eliyahu Hershfeld 2004 - 2016
|
|
2161
2068
|
* @version 1.1
|
|
@@ -2179,26 +2086,33 @@ class GeoLocation {
|
|
|
2179
2086
|
* @param {string} timeZoneId
|
|
2180
2087
|
* the <code>TimeZone</code> for the location.
|
|
2181
2088
|
*/
|
|
2182
|
-
constructor(name, latitude, longitude,
|
|
2183
|
-
/**
|
|
2184
|
-
* @private
|
|
2185
|
-
* @see #getLocationName()
|
|
2186
|
-
* @see #setLocationName(String)
|
|
2187
|
-
*/
|
|
2188
|
-
this.locationName = null;
|
|
2189
|
-
let elevation = 0;
|
|
2190
|
-
if (timeZoneId) {
|
|
2191
|
-
elevation = elevationOrTimeZoneId;
|
|
2192
|
-
}
|
|
2193
|
-
else {
|
|
2194
|
-
timeZoneId = elevationOrTimeZoneId;
|
|
2195
|
-
}
|
|
2089
|
+
constructor(name, latitude, longitude, elevation, timeZoneId) {
|
|
2196
2090
|
this.setLocationName(name);
|
|
2197
2091
|
this.setLatitude(latitude);
|
|
2198
2092
|
this.setLongitude(longitude);
|
|
2199
2093
|
this.setElevation(elevation);
|
|
2200
2094
|
this.setTimeZone(timeZoneId);
|
|
2201
2095
|
}
|
|
2096
|
+
/**
|
|
2097
|
+
* @private
|
|
2098
|
+
*/
|
|
2099
|
+
latitude;
|
|
2100
|
+
/**
|
|
2101
|
+
* @private
|
|
2102
|
+
*/
|
|
2103
|
+
longitude;
|
|
2104
|
+
/**
|
|
2105
|
+
* @private
|
|
2106
|
+
*/
|
|
2107
|
+
locationName = null;
|
|
2108
|
+
/**
|
|
2109
|
+
* @private
|
|
2110
|
+
*/
|
|
2111
|
+
timeZoneId;
|
|
2112
|
+
/**
|
|
2113
|
+
* @private
|
|
2114
|
+
*/
|
|
2115
|
+
elevation;
|
|
2202
2116
|
/**
|
|
2203
2117
|
* Method to get the elevation in Meters.
|
|
2204
2118
|
*
|
|
@@ -2211,9 +2125,14 @@ class GeoLocation {
|
|
|
2211
2125
|
* Method to set the elevation in Meters <b>above </b> sea level.
|
|
2212
2126
|
*
|
|
2213
2127
|
* @param {number} elevation
|
|
2214
|
-
* The elevation to set in Meters. An
|
|
2128
|
+
* The elevation to set in Meters. An Error will be thrown if the value is a negative.
|
|
2215
2129
|
*/
|
|
2216
2130
|
setElevation(elevation) {
|
|
2131
|
+
if (typeof elevation !== 'number')
|
|
2132
|
+
throw new TypeError('Invalid elevation');
|
|
2133
|
+
if (elevation < 0) {
|
|
2134
|
+
throw new RangeError(`elevation ${elevation} must be zero or positive`);
|
|
2135
|
+
}
|
|
2217
2136
|
this.elevation = elevation;
|
|
2218
2137
|
}
|
|
2219
2138
|
setLatitude(latitude) {
|
|
@@ -2264,21 +2183,14 @@ class GeoLocation {
|
|
|
2264
2183
|
return this.timeZoneId;
|
|
2265
2184
|
}
|
|
2266
2185
|
/**
|
|
2267
|
-
* Method to set the TimeZone.
|
|
2268
|
-
*
|
|
2269
|
-
* {@link AstronomicalCalendar#getCalendar()}.
|
|
2270
|
-
* {@link java.util.Calendar#setTimeZone(TimeZone) setTimeZone(TimeZone)} be called in order for the
|
|
2271
|
-
* AstronomicalCalendar to output times in the expected offset. This situation will arise if the
|
|
2272
|
-
* AstronomicalCalendar is ever {@link AstronomicalCalendar#clone() cloned}.
|
|
2273
|
-
*
|
|
2274
|
-
* @param {string} timeZone
|
|
2186
|
+
* Method to set the TimeZone.
|
|
2187
|
+
* @param {string} timeZoneId
|
|
2275
2188
|
* The timeZone to set.
|
|
2276
2189
|
*/
|
|
2277
2190
|
setTimeZone(timeZoneId) {
|
|
2278
2191
|
this.timeZoneId = timeZoneId;
|
|
2279
2192
|
}
|
|
2280
2193
|
}
|
|
2281
|
-
exports.GeoLocation = esm.GeoLocation = GeoLocation;
|
|
2282
2194
|
/**
|
|
2283
2195
|
* The commonly used average solar refraction. Calendrical Calculations lists a more accurate global average of
|
|
2284
2196
|
* 34.478885263888294
|
|
@@ -2313,43 +2225,72 @@ const earthRadius = 6356.9; // in KM
|
|
|
2313
2225
|
class NOAACalculator {
|
|
2314
2226
|
/**
|
|
2315
2227
|
* A constructor that takes in <a href="http://en.wikipedia.org/wiki/Geolocation">geolocation</a> information as a
|
|
2316
|
-
* parameter.
|
|
2317
|
-
* calculations is the the {@link NOAACalculator}.
|
|
2228
|
+
* parameter.
|
|
2318
2229
|
*
|
|
2319
2230
|
* @param {GeoLocation} geoLocation
|
|
2320
2231
|
* The location information used for calculating astronomical sun times.
|
|
2321
2232
|
* @param {Temporal.PlainDate} date
|
|
2322
|
-
*
|
|
2323
|
-
* @see #setAstronomicalCalculator(AstronomicalCalculator) for changing the calculator class.
|
|
2324
2233
|
*/
|
|
2325
2234
|
constructor(geoLocation, date) {
|
|
2326
2235
|
this.date = date;
|
|
2327
2236
|
this.geoLocation = geoLocation;
|
|
2328
2237
|
}
|
|
2238
|
+
/**
|
|
2239
|
+
* The zenith of astronomical sunrise and sunset. The sun is 90° from the vertical 0°
|
|
2240
|
+
* @private
|
|
2241
|
+
*/
|
|
2242
|
+
static GEOMETRIC_ZENITH = 90;
|
|
2243
|
+
/**
|
|
2244
|
+
* Default value for Sun's zenith and true rise/set Zenith (used in this class and subclasses) is the angle that the
|
|
2245
|
+
* center of the Sun makes to a line perpendicular to the Earth's surface. If the Sun were a point and the Earth
|
|
2246
|
+
* were without an atmosphere, true sunset and sunrise would correspond to a 90° zenith. Because the Sun is not
|
|
2247
|
+
* a point, and because the atmosphere refracts light, this 90° zenith does not, in fact, correspond to true
|
|
2248
|
+
* sunset or sunrise, instead the center of the Sun's disk must lie just below the horizon for the upper edge to be
|
|
2249
|
+
* obscured. This means that a zenith of just above 90° must be used. The Sun subtends an angle of 16 minutes of
|
|
2250
|
+
* arc, and atmospheric refraction accounts for
|
|
2251
|
+
* 34 minutes or so, giving a total of 50
|
|
2252
|
+
* arcminutes. The total value for ZENITH is 90+(5/6) or 90.8333333° for true sunrise/sunset.
|
|
2253
|
+
*/
|
|
2254
|
+
// const ZENITH: number = GEOMETRIC_ZENITH + 5.0 / 6.0;
|
|
2255
|
+
/** Sun's zenith at civil twilight (96°). */
|
|
2256
|
+
static CIVIL_ZENITH = 96;
|
|
2257
|
+
/** Sun's zenith at nautical twilight (102°). */
|
|
2258
|
+
static NAUTICAL_ZENITH = 102;
|
|
2259
|
+
/** Sun's zenith at astronomical twilight (108°). */
|
|
2260
|
+
static ASTRONOMICAL_ZENITH = 108;
|
|
2261
|
+
/**
|
|
2262
|
+
* The Java Calendar encapsulated by this class to track the current date used by the class
|
|
2263
|
+
* @private
|
|
2264
|
+
*/
|
|
2265
|
+
date;
|
|
2266
|
+
/**
|
|
2267
|
+
* the {@link GeoLocation} used for calculations.
|
|
2268
|
+
* @private
|
|
2269
|
+
*/
|
|
2270
|
+
geoLocation;
|
|
2329
2271
|
/**
|
|
2330
2272
|
* The getSunrise method Returns a `Date` representing the
|
|
2331
|
-
* {@link
|
|
2332
|
-
* for the calculation uses {@link
|
|
2333
|
-
* {@link
|
|
2334
|
-
*
|
|
2335
|
-
* and 16 archminutes for the sun's radius for a total of {@link
|
|
2336
|
-
* See documentation for the specific implementation of the {@link AstronomicalCalculator} that you are using.
|
|
2273
|
+
* {@link getElevationAdjustment elevation adjusted} sunrise time. The zenith used
|
|
2274
|
+
* for the calculation uses {@link GEOMETRIC_ZENITH geometric zenith} of 90° plus
|
|
2275
|
+
* {@link getElevationAdjustment}. This is adjusted
|
|
2276
|
+
* to add approximately 50/60 of a degree to account for 34 archminutes of refraction
|
|
2277
|
+
* and 16 archminutes for the sun's radius for a total of {@link adjustZenith 90.83333°}.
|
|
2337
2278
|
*
|
|
2338
2279
|
* @return {Temporal.ZonedDateTime | null} the `Date` representing the exact sunrise time. If the calculation can't be computed such as
|
|
2339
2280
|
* in the Arctic Circle where there is at least one day a year where the sun does not rise, and one where it
|
|
2340
2281
|
* does not set, a null will be returned. See detailed explanation on top of the page.
|
|
2341
|
-
* @see
|
|
2342
|
-
* @see
|
|
2343
|
-
* @see
|
|
2282
|
+
* @see adjustZenith
|
|
2283
|
+
* @see getSeaLevelSunrise()
|
|
2284
|
+
* @see getUTCSunrise
|
|
2344
2285
|
*/
|
|
2345
2286
|
getSunrise() {
|
|
2346
2287
|
const sunrise = this.getUTCSunrise0(NOAACalculator.GEOMETRIC_ZENITH);
|
|
2347
|
-
if (
|
|
2288
|
+
if (isNaN(sunrise))
|
|
2348
2289
|
return null;
|
|
2349
2290
|
return this.getDateFromTime(sunrise, true);
|
|
2350
2291
|
}
|
|
2351
2292
|
/**
|
|
2352
|
-
* A method that returns the sunrise without {@link
|
|
2293
|
+
* A method that returns the sunrise without {@link getElevationAdjustment elevation
|
|
2353
2294
|
* adjustment}. Non-sunrise and sunset calculations such as dawn and dusk, depend on the amount of visible light,
|
|
2354
2295
|
* something that is not affected by elevation. This method returns sunrise calculated at sea level. This forms the
|
|
2355
2296
|
* base for dawn calculations that are calculated as a dip below the horizon before sunrise.
|
|
@@ -2357,55 +2298,55 @@ class NOAACalculator {
|
|
|
2357
2298
|
* @return {Temporal.ZonedDateTime | null} the `Date` representing the exact sea-level sunrise time. If the calculation can't be computed
|
|
2358
2299
|
* such as in the Arctic Circle where there is at least one day a year where the sun does not rise, and one
|
|
2359
2300
|
* where it does not set, a null will be returned. See detailed explanation on top of the page.
|
|
2360
|
-
* @see
|
|
2361
|
-
* @see
|
|
2362
|
-
* @see
|
|
2301
|
+
* @see getSunrise
|
|
2302
|
+
* @see getUTCSeaLevelSunrise
|
|
2303
|
+
* @see getSeaLevelSunset()
|
|
2363
2304
|
*/
|
|
2364
2305
|
getSeaLevelSunrise() {
|
|
2365
2306
|
const sunrise = this.getUTCSeaLevelSunrise(NOAACalculator.GEOMETRIC_ZENITH);
|
|
2366
|
-
if (
|
|
2307
|
+
if (isNaN(sunrise))
|
|
2367
2308
|
return null;
|
|
2368
2309
|
return this.getDateFromTime(sunrise, true);
|
|
2369
2310
|
}
|
|
2370
2311
|
/**
|
|
2371
|
-
* A method that returns the beginning of civil twilight (dawn) using a zenith of {@link
|
|
2312
|
+
* A method that returns the beginning of civil twilight (dawn) using a zenith of {@link CIVIL_ZENITH 96°}.
|
|
2372
2313
|
*
|
|
2373
2314
|
* @return {Temporal.ZonedDateTime | null} The `Date` of the beginning of civil twilight using a zenith of 96°. If the calculation
|
|
2374
2315
|
* can't be computed, null will be returned. See detailed explanation on top of the page.
|
|
2375
|
-
* @see
|
|
2316
|
+
* @see CIVIL_ZENITH
|
|
2376
2317
|
*/
|
|
2377
2318
|
getBeginCivilTwilight() {
|
|
2378
2319
|
return this.getSunriseOffsetByDegrees(NOAACalculator.CIVIL_ZENITH);
|
|
2379
2320
|
}
|
|
2380
2321
|
/**
|
|
2381
|
-
* A method that returns the beginning of nautical twilight using a zenith of {@link
|
|
2322
|
+
* A method that returns the beginning of nautical twilight using a zenith of {@link NAUTICAL_ZENITH 102°}.
|
|
2382
2323
|
*
|
|
2383
2324
|
* @return {Temporal.ZonedDateTime | null} The `Date` of the beginning of nautical twilight using a zenith of 102°. If the
|
|
2384
2325
|
* calculation can't be computed null will be returned. See detailed explanation on top of the page.
|
|
2385
|
-
* @see
|
|
2326
|
+
* @see NAUTICAL_ZENITH
|
|
2386
2327
|
*/
|
|
2387
2328
|
getBeginNauticalTwilight() {
|
|
2388
2329
|
return this.getSunriseOffsetByDegrees(NOAACalculator.NAUTICAL_ZENITH);
|
|
2389
2330
|
}
|
|
2390
2331
|
/**
|
|
2391
|
-
* A method that returns the beginning of astronomical twilight using a zenith of {@link
|
|
2332
|
+
* A method that returns the beginning of astronomical twilight using a zenith of {@link ASTRONOMICAL_ZENITH
|
|
2392
2333
|
* 108°}.
|
|
2393
2334
|
*
|
|
2394
2335
|
* @return {Temporal.ZonedDateTime | null} The `Date` of the beginning of astronomical twilight using a zenith of 108°. If the
|
|
2395
2336
|
* calculation can't be computed, null will be returned. See detailed explanation on top of the page.
|
|
2396
|
-
* @see
|
|
2337
|
+
* @see ASTRONOMICAL_ZENITH
|
|
2397
2338
|
*/
|
|
2398
2339
|
getBeginAstronomicalTwilight() {
|
|
2399
2340
|
return this.getSunriseOffsetByDegrees(NOAACalculator.ASTRONOMICAL_ZENITH);
|
|
2400
2341
|
}
|
|
2401
2342
|
/**
|
|
2402
2343
|
* The getSunset method Returns a `Date` representing the
|
|
2403
|
-
* {@link
|
|
2404
|
-
* the calculation uses {@link
|
|
2405
|
-
* {@link
|
|
2406
|
-
*
|
|
2407
|
-
* and 16 archminutes for the sun's radius for a total of {@link
|
|
2408
|
-
*
|
|
2344
|
+
* {@link getElevationAdjustment elevation adjusted} sunset time. The zenith used for
|
|
2345
|
+
* the calculation uses {@link GEOMETRIC_ZENITH geometric zenith} of 90° plus
|
|
2346
|
+
* {@link getElevationAdjustment}. This is adjusted
|
|
2347
|
+
* to add approximately 50/60 of a degree to account for 34 archminutes of refraction
|
|
2348
|
+
* and 16 archminutes for the sun's radius for a total of {@link adjustZenith 90.83333°}.
|
|
2349
|
+
* Note:
|
|
2409
2350
|
* In certain cases the calculates sunset will occur before sunrise. This will typically happen when a timezone
|
|
2410
2351
|
* other than the local timezone is used (calculating Los Angeles sunset using a GMT timezone for example). In this
|
|
2411
2352
|
* case the sunset date will be incremented to the following date.
|
|
@@ -2413,18 +2354,18 @@ class NOAACalculator {
|
|
|
2413
2354
|
* @return {Temporal.ZonedDateTime | null} The `Date` representing the exact sunset time. If the calculation can't be computed such as in
|
|
2414
2355
|
* the Arctic Circle where there is at least one day a year where the sun does not rise, and one where it
|
|
2415
2356
|
* does not set, a null will be returned. See detailed explanation on top of the page.
|
|
2416
|
-
* @see
|
|
2417
|
-
* @see
|
|
2418
|
-
* @see
|
|
2357
|
+
* @see adjustZenith
|
|
2358
|
+
* @see getSeaLevelSunset()
|
|
2359
|
+
* @see getUTCSunset
|
|
2419
2360
|
*/
|
|
2420
2361
|
getSunset() {
|
|
2421
2362
|
const sunset = this.getUTCSunset0(NOAACalculator.GEOMETRIC_ZENITH);
|
|
2422
|
-
if (
|
|
2363
|
+
if (isNaN(sunset))
|
|
2423
2364
|
return null;
|
|
2424
2365
|
return this.getDateFromTime(sunset, false);
|
|
2425
2366
|
}
|
|
2426
2367
|
/**
|
|
2427
|
-
* A method that returns the sunset without {@link
|
|
2368
|
+
* A method that returns the sunset without {@link getElevationAdjustment elevation
|
|
2428
2369
|
* adjustment}. Non-sunrise and sunset calculations such as dawn and dusk, depend on the amount of visible light,
|
|
2429
2370
|
* something that is not affected by elevation. This method returns sunset calculated at sea level. This forms the
|
|
2430
2371
|
* base for dusk calculations that are calculated as a dip below the horizon after sunset.
|
|
@@ -2432,43 +2373,43 @@ class NOAACalculator {
|
|
|
2432
2373
|
* @return {Temporal.ZonedDateTime | null} The `Date` representing the exact sea-level sunset time. If the calculation can't be computed
|
|
2433
2374
|
* such as in the Arctic Circle where there is at least one day a year where the sun does not rise, and one
|
|
2434
2375
|
* where it does not set, a null will be returned. See detailed explanation on top of the page.
|
|
2435
|
-
* @see
|
|
2436
|
-
* @see
|
|
2376
|
+
* @see getSunset
|
|
2377
|
+
* @see getUTCSeaLevelSunset
|
|
2437
2378
|
*/
|
|
2438
2379
|
getSeaLevelSunset() {
|
|
2439
2380
|
const sunset = this.getUTCSeaLevelSunset(NOAACalculator.GEOMETRIC_ZENITH);
|
|
2440
|
-
if (
|
|
2381
|
+
if (isNaN(sunset))
|
|
2441
2382
|
return null;
|
|
2442
2383
|
return this.getDateFromTime(sunset, false);
|
|
2443
2384
|
}
|
|
2444
2385
|
/**
|
|
2445
|
-
* A method that returns the end of civil twilight using a zenith of {@link
|
|
2386
|
+
* A method that returns the end of civil twilight using a zenith of {@link CIVIL_ZENITH 96°}.
|
|
2446
2387
|
*
|
|
2447
|
-
* @return {Temporal.ZonedDateTime | null} The `Date` of the end of civil twilight using a zenith of {@link
|
|
2388
|
+
* @return {Temporal.ZonedDateTime | null} The `Date` of the end of civil twilight using a zenith of {@link CIVIL_ZENITH 96°}. If
|
|
2448
2389
|
* the calculation can't be computed, null will be returned. See detailed explanation on top of the page.
|
|
2449
|
-
* @see
|
|
2390
|
+
* @see CIVIL_ZENITH
|
|
2450
2391
|
*/
|
|
2451
2392
|
getEndCivilTwilight() {
|
|
2452
2393
|
return this.getSunsetOffsetByDegrees(NOAACalculator.CIVIL_ZENITH);
|
|
2453
2394
|
}
|
|
2454
2395
|
/**
|
|
2455
|
-
* A method that returns the end of nautical twilight using a zenith of {@link
|
|
2396
|
+
* A method that returns the end of nautical twilight using a zenith of {@link NAUTICAL_ZENITH 102°}.
|
|
2456
2397
|
*
|
|
2457
|
-
* @return {Temporal.ZonedDateTime | null} The `Date` of the end of nautical twilight using a zenith of {@link
|
|
2398
|
+
* @return {Temporal.ZonedDateTime | null} The `Date` of the end of nautical twilight using a zenith of {@link NAUTICAL_ZENITH 102°}
|
|
2458
2399
|
* . If the calculation can't be computed, null will be returned. See detailed explanation on top of the
|
|
2459
2400
|
* page.
|
|
2460
|
-
* @see
|
|
2401
|
+
* @see NAUTICAL_ZENITH
|
|
2461
2402
|
*/
|
|
2462
2403
|
getEndNauticalTwilight() {
|
|
2463
2404
|
return this.getSunsetOffsetByDegrees(NOAACalculator.NAUTICAL_ZENITH);
|
|
2464
2405
|
}
|
|
2465
2406
|
/**
|
|
2466
|
-
* A method that returns the end of astronomical twilight using a zenith of {@link
|
|
2407
|
+
* A method that returns the end of astronomical twilight using a zenith of {@link ASTRONOMICAL_ZENITH 108°}.
|
|
2467
2408
|
*
|
|
2468
|
-
* @return {Temporal.ZonedDateTime | null} The `Date` of the end of astronomical twilight using a zenith of {@link
|
|
2409
|
+
* @return {Temporal.ZonedDateTime | null} The `Date` of the end of astronomical twilight using a zenith of {@link ASTRONOMICAL_ZENITH
|
|
2469
2410
|
* 108°}. If the calculation can't be computed, null will be returned. See detailed explanation on top
|
|
2470
2411
|
* of the page.
|
|
2471
|
-
* @see
|
|
2412
|
+
* @see ASTRONOMICAL_ZENITH
|
|
2472
2413
|
*/
|
|
2473
2414
|
getEndAstronomicalTwilight() {
|
|
2474
2415
|
return this.getSunsetOffsetByDegrees(NOAACalculator.ASTRONOMICAL_ZENITH);
|
|
@@ -2486,49 +2427,49 @@ class NOAACalculator {
|
|
|
2486
2427
|
* @return {Temporal.ZonedDateTime | null} the `Date` with the offset in milliseconds added to it
|
|
2487
2428
|
*/
|
|
2488
2429
|
static getTimeOffset(time, offset) {
|
|
2489
|
-
if (time === null ||
|
|
2430
|
+
if (time === null || isNaN(offset)) {
|
|
2490
2431
|
return null;
|
|
2491
2432
|
}
|
|
2492
2433
|
return time.add({ milliseconds: offset });
|
|
2493
2434
|
}
|
|
2494
2435
|
/**
|
|
2495
2436
|
* A utility method that returns the time of an offset by degrees below or above the horizon of
|
|
2496
|
-
* {@link
|
|
2497
|
-
* before sunrise, an offset of 14 + {@link
|
|
2437
|
+
* {@link getSunrise() sunrise}. Note that the degree offset is from the vertical, so for a calculation of 14°
|
|
2438
|
+
* before sunrise, an offset of 14 + {@link GEOMETRIC_ZENITH} = 104 would have to be passed as a parameter.
|
|
2498
2439
|
*
|
|
2499
2440
|
* @param {number} offsetZenith
|
|
2500
|
-
* the degrees before {@link
|
|
2441
|
+
* the degrees before {@link getSunrise} to use in the calculation. For time after sunrise use
|
|
2501
2442
|
* negative numbers. Note that the degree offset is from the vertical, so for a calculation of 14°
|
|
2502
|
-
* before sunrise, an offset of 14 + {@link
|
|
2443
|
+
* before sunrise, an offset of 14 + {@link GEOMETRIC_ZENITH} = 104 would have to be passed as a
|
|
2503
2444
|
* parameter.
|
|
2504
|
-
* @return {Temporal.ZonedDateTime | null} The `Date` of the offset after (or before) {@link
|
|
2445
|
+
* @return {Temporal.ZonedDateTime | null} The `Date` of the offset after (or before) {@link getSunrise}. If the calculation
|
|
2505
2446
|
* can't be computed such as in the Arctic Circle where there is at least one day a year where the sun does
|
|
2506
2447
|
* not rise, and one where it does not set, a null will be returned. See detailed explanation on top of the
|
|
2507
2448
|
* page.
|
|
2508
2449
|
*/
|
|
2509
2450
|
getSunriseOffsetByDegrees(offsetZenith) {
|
|
2510
2451
|
const dawn = this.getUTCSunrise0(offsetZenith);
|
|
2511
|
-
if (
|
|
2452
|
+
if (isNaN(dawn))
|
|
2512
2453
|
return null;
|
|
2513
2454
|
return this.getDateFromTime(dawn, true);
|
|
2514
2455
|
}
|
|
2515
2456
|
/**
|
|
2516
|
-
* A utility method that returns the time of an offset by degrees below or above the horizon of {@link
|
|
2457
|
+
* A utility method that returns the time of an offset by degrees below or above the horizon of {@link getSunset()
|
|
2517
2458
|
* sunset}. Note that the degree offset is from the vertical, so for a calculation of 14° after sunset, an
|
|
2518
|
-
* offset of 14 + {@link
|
|
2459
|
+
* offset of 14 + {@link GEOMETRIC_ZENITH} = 104 would have to be passed as a parameter.
|
|
2519
2460
|
*
|
|
2520
2461
|
* @param {number} offsetZenith
|
|
2521
|
-
* the degrees after {@link
|
|
2462
|
+
* the degrees after {@link getSunset} to use in the calculation. For time before sunset use negative
|
|
2522
2463
|
* numbers. Note that the degree offset is from the vertical, so for a calculation of 14° after
|
|
2523
|
-
* sunset, an offset of 14 + {@link
|
|
2524
|
-
* @return {Temporal.ZonedDateTime | null} The `Date`of the offset after (or before) {@link
|
|
2464
|
+
* sunset, an offset of 14 + {@link GEOMETRIC_ZENITH} = 104 would have to be passed as a parameter.
|
|
2465
|
+
* @return {Temporal.ZonedDateTime | null} The `Date`of the offset after (or before) {@link getSunset}. If the calculation can't
|
|
2525
2466
|
* be computed such as in the Arctic Circle where there is at least one day a year where the sun does not
|
|
2526
2467
|
* rise, and one where it does not set, a null will be returned. See detailed explanation on top of the
|
|
2527
2468
|
* page.
|
|
2528
2469
|
*/
|
|
2529
2470
|
getSunsetOffsetByDegrees(offsetZenith) {
|
|
2530
2471
|
const sunset = this.getUTCSunset0(offsetZenith);
|
|
2531
|
-
if (
|
|
2472
|
+
if (isNaN(sunset))
|
|
2532
2473
|
return null;
|
|
2533
2474
|
return this.getDateFromTime(sunset, false);
|
|
2534
2475
|
}
|
|
@@ -2540,7 +2481,7 @@ class NOAACalculator {
|
|
|
2540
2481
|
* the degrees below the horizon. For time after sunrise use negative numbers.
|
|
2541
2482
|
* @return {number} The time in the format: 18.75 for 18:45:00 UTC/GMT. If the calculation can't be computed such as in the
|
|
2542
2483
|
* Arctic Circle where there is at least one day a year where the sun does not rise, and one where it does
|
|
2543
|
-
* not set,
|
|
2484
|
+
* not set, `NaN` will be returned. See detailed explanation on top of the page.
|
|
2544
2485
|
*/
|
|
2545
2486
|
getUTCSunrise0(zenith) {
|
|
2546
2487
|
return this.getUTCSunrise(this.getAdjustedDate(), this.geoLocation, zenith, true);
|
|
@@ -2555,9 +2496,9 @@ class NOAACalculator {
|
|
|
2555
2496
|
* the degrees below the horizon. For time after sunrise use negative numbers.
|
|
2556
2497
|
* @return {number} The time in the format: 18.75 for 18:45:00 UTC/GMT. If the calculation can't be computed such as in the
|
|
2557
2498
|
* Arctic Circle where there is at least one day a year where the sun does not rise, and one where it does
|
|
2558
|
-
* not set,
|
|
2559
|
-
* @see
|
|
2560
|
-
* @see
|
|
2499
|
+
* not set, `NaN` will be returned. See detailed explanation on top of the page.
|
|
2500
|
+
* @see getUTCSunrise
|
|
2501
|
+
* @see getUTCSeaLevelSunset
|
|
2561
2502
|
*/
|
|
2562
2503
|
getUTCSeaLevelSunrise(zenith) {
|
|
2563
2504
|
return this.getUTCSunrise(this.getAdjustedDate(), this.geoLocation, zenith, false);
|
|
@@ -2570,8 +2511,8 @@ class NOAACalculator {
|
|
|
2570
2511
|
* the degrees below the horizon. For time after sunset use negative numbers.
|
|
2571
2512
|
* @return {number} The time in the format: 18.75 for 18:45:00 UTC/GMT. If the calculation can't be computed such as in the
|
|
2572
2513
|
* Arctic Circle where there is at least one day a year where the sun does not rise, and one where it does
|
|
2573
|
-
* not set,
|
|
2574
|
-
* @see
|
|
2514
|
+
* not set, `NaN` will be returned. See detailed explanation on top of the page.
|
|
2515
|
+
* @see getUTCSeaLevelSunset
|
|
2575
2516
|
*/
|
|
2576
2517
|
getUTCSunset0(zenith) {
|
|
2577
2518
|
return this.getUTCSunset(this.getAdjustedDate(), this.geoLocation, zenith, true);
|
|
@@ -2587,9 +2528,9 @@ class NOAACalculator {
|
|
|
2587
2528
|
* the degrees below the horizon. For time before sunset use negative numbers.
|
|
2588
2529
|
* @return {number} The time in the format: 18.75 for 18:45:00 UTC/GMT. If the calculation can't be computed such as in the
|
|
2589
2530
|
* Arctic Circle where there is at least one day a year where the sun does not rise, and one where it does
|
|
2590
|
-
* not set,
|
|
2591
|
-
* @see
|
|
2592
|
-
* @see
|
|
2531
|
+
* not set, `NaN` will be returned. See detailed explanation on top of the page.
|
|
2532
|
+
* @see getUTCSunset
|
|
2533
|
+
* @see getUTCSeaLevelSunrise
|
|
2593
2534
|
*/
|
|
2594
2535
|
getUTCSeaLevelSunset(zenith) {
|
|
2595
2536
|
return this.getUTCSunset(this.getAdjustedDate(), this.geoLocation, zenith, false);
|
|
@@ -2607,9 +2548,9 @@ class NOAACalculator {
|
|
|
2607
2548
|
* Method to return the adjustment to the zenith required to account for the elevation. Since a person at a higher
|
|
2608
2549
|
* elevation can see farther below the horizon, the calculation for sunrise / sunset is calculated below the horizon
|
|
2609
2550
|
* used at sea level. This is only used for sunrise and sunset and not times before or after it such as
|
|
2610
|
-
* {@link
|
|
2551
|
+
* {@link getBeginNauticalTwilight() nautical twilight} since those
|
|
2611
2552
|
* calculations are based on the level of available light at the given dip below the horizon, something that is not
|
|
2612
|
-
* affected by elevation, the adjustment should only made if the zenith == 90° {@link
|
|
2553
|
+
* affected by elevation, the adjustment should only made if the zenith == 90° {@link adjustZenith adjusted}
|
|
2613
2554
|
* for refraction and solar radius. The algorithm used is
|
|
2614
2555
|
*
|
|
2615
2556
|
* <pre>
|
|
@@ -2641,30 +2582,30 @@ class NOAACalculator {
|
|
|
2641
2582
|
* is not a point, and because the atmosphere refracts light, this 90° zenith does not, in fact, correspond to
|
|
2642
2583
|
* true sunset or sunrise, instead the centre of the Sun's disk must lie just below the horizon for the upper edge
|
|
2643
2584
|
* to be obscured. This means that a zenith of just above 90° must be used. The Sun subtends an angle of 16
|
|
2644
|
-
* minutes of arc
|
|
2645
|
-
* accounts for 34 minutes or so
|
|
2585
|
+
* minutes of arc, and atmospheric refraction
|
|
2586
|
+
* accounts for 34 minutes or so, giving a total
|
|
2646
2587
|
* of 50 arcminutes. The total value for ZENITH is 90+(5/6) or 90.8333333° for true sunrise/sunset. Since a
|
|
2647
2588
|
* person at an elevation can see blow the horizon of a person at sea level, this will also adjust the zenith to
|
|
2648
2589
|
* account for elevation if available. Note that this will only adjust the value if the zenith is exactly 90 degrees.
|
|
2649
2590
|
* For values below and above this no correction is done. As an example, astronomical twilight is when the sun is
|
|
2650
|
-
* 18° below the horizon or {@link
|
|
2591
|
+
* 18° below the horizon or {@link ASTRONOMICAL_ZENITH 108°
|
|
2651
2592
|
* below the zenith}. This is traditionally calculated with none of the above mentioned adjustments. The same goes
|
|
2652
2593
|
* for various <em>tzais</em> and <em>alos</em> times such as the
|
|
2653
2594
|
* {@link ZmanimCalendar#ZENITH_16_POINT_1 16.1°} dip used in
|
|
2654
|
-
* {@link ComplexZmanimCalendar#getAlos16Point1Degrees
|
|
2595
|
+
* {@link ComplexZmanimCalendar#getAlos16Point1Degrees}.
|
|
2655
2596
|
*
|
|
2656
2597
|
* @param {number} zenith
|
|
2657
|
-
* the azimuth below the vertical zenith of 90°. For sunset typically the {@link
|
|
2658
|
-
* zenith} used for the calculation uses geometric zenith of 90° and {@link
|
|
2598
|
+
* the azimuth below the vertical zenith of 90°. For sunset typically the {@link adjustZenith
|
|
2599
|
+
* zenith} used for the calculation uses geometric zenith of 90° and {@link adjustZenith adjusts}
|
|
2659
2600
|
* this slightly to account for solar refraction and the sun's radius. Another example would be
|
|
2660
|
-
* {@link
|
|
2661
|
-
* {@link
|
|
2601
|
+
* {@link getEndNauticalTwilight} that passes
|
|
2602
|
+
* {@link NAUTICAL_ZENITH} to this method.
|
|
2662
2603
|
* @param {number} elevation
|
|
2663
2604
|
* elevation in Meters.
|
|
2664
|
-
* @return {number} The zenith adjusted to include the
|
|
2665
|
-
*
|
|
2605
|
+
* @return {number} The zenith adjusted to include the sun's radius, refracton
|
|
2606
|
+
* and {@link getElevationAdjustment elevation} adjustment. This will only be adjusted for
|
|
2666
2607
|
* sunrise and sunset (if the zenith == 90°)
|
|
2667
|
-
* @see
|
|
2608
|
+
* @see getElevationAdjustment
|
|
2668
2609
|
*/
|
|
2669
2610
|
adjustZenith(zenith, elevation) {
|
|
2670
2611
|
let adjustedZenith = zenith;
|
|
@@ -2677,7 +2618,32 @@ class NOAACalculator {
|
|
|
2677
2618
|
return adjustedZenith;
|
|
2678
2619
|
}
|
|
2679
2620
|
/**
|
|
2680
|
-
*
|
|
2621
|
+
* The <a href="http://en.wikipedia.org/wiki/Julian_day">Julian day</a> of January 1, 2000
|
|
2622
|
+
* @private
|
|
2623
|
+
*/
|
|
2624
|
+
static JULIAN_DAY_JAN_1_2000 = 2451545;
|
|
2625
|
+
/**
|
|
2626
|
+
* Julian days per century
|
|
2627
|
+
* @private
|
|
2628
|
+
*/
|
|
2629
|
+
static JULIAN_DAYS_PER_CENTURY = 36525;
|
|
2630
|
+
/**
|
|
2631
|
+
* A method that calculates UTC sunrise as well as any time based on an angle above or below sunrise.
|
|
2632
|
+
* @param date
|
|
2633
|
+
* Used to calculate day of year.
|
|
2634
|
+
* @param geoLocation
|
|
2635
|
+
* The location information used for astronomical calculating sun times.
|
|
2636
|
+
* @param zenith
|
|
2637
|
+
* the azimuth below the vertical zenith of 90 degrees. for sunrise typically the {@link adjustZenith
|
|
2638
|
+
* zenith} used for the calculation uses geometric zenith of 90° and {@link adjustZenith adjusts}
|
|
2639
|
+
* this slightly to account for solar refraction and the sun's radius. Another example would be
|
|
2640
|
+
* {@link getBeginNauticalTwilight} that passes
|
|
2641
|
+
* {@link NAUTICAL_ZENITH} to this method.
|
|
2642
|
+
* @param adjustForElevation
|
|
2643
|
+
* Should the time be adjusted for elevation
|
|
2644
|
+
* @return The UTC time of sunrise in 24 hour format. 5:45:00 AM will return 5.75.0. If an error was encountered in
|
|
2645
|
+
* the calculation (expected behavior for some locations such as near the poles,
|
|
2646
|
+
* `NaN` will be returned.
|
|
2681
2647
|
*/
|
|
2682
2648
|
getUTCSunrise(date, geoLocation, zenith, adjustForElevation) {
|
|
2683
2649
|
const elevation = adjustForElevation
|
|
@@ -2696,7 +2662,22 @@ class NOAACalculator {
|
|
|
2696
2662
|
return sunrise;
|
|
2697
2663
|
}
|
|
2698
2664
|
/**
|
|
2699
|
-
*
|
|
2665
|
+
* A method that calculates UTC sunset as well as any time based on an angle above or below sunset.
|
|
2666
|
+
* @param date
|
|
2667
|
+
* Used to calculate day of year.
|
|
2668
|
+
* @param geoLocation
|
|
2669
|
+
* The location information used for astronomical calculating sun times.
|
|
2670
|
+
* @param zenith
|
|
2671
|
+
* the azimuth below the vertical zenith of 90°. For sunset typically the {@link adjustZenith
|
|
2672
|
+
* zenith} used for the calculation uses geometric zenith of 90° and {@link adjustZenith adjusts}
|
|
2673
|
+
* this slightly to account for solar refraction and the sun's radius. Another example would be
|
|
2674
|
+
* {@link getEndNauticalTwilight} that passes
|
|
2675
|
+
* {@link NAUTICAL_ZENITH} to this method.
|
|
2676
|
+
* @param adjustForElevation
|
|
2677
|
+
* Should the time be adjusted for elevation
|
|
2678
|
+
* @return The UTC time of sunset in 24 hour format. 5:45:00 AM will return 5.75.0. If an error was encountered in
|
|
2679
|
+
* the calculation (expected behavior for some locations such as near the poles,
|
|
2680
|
+
* `NaN` will be returned.
|
|
2700
2681
|
*/
|
|
2701
2682
|
getUTCSunset(date, geoLocation, zenith, adjustForElevation) {
|
|
2702
2683
|
const elevation = adjustForElevation
|
|
@@ -2717,8 +2698,8 @@ class NOAACalculator {
|
|
|
2717
2698
|
/**
|
|
2718
2699
|
* A utility method that will allow the calculation of a temporal (solar) hour based on the sunrise and sunset
|
|
2719
2700
|
* passed as parameters to this method. An example of the use of this method would be the calculation of a
|
|
2720
|
-
* non-elevation adjusted temporal hour by passing in {@link
|
|
2721
|
-
* {@link
|
|
2701
|
+
* non-elevation adjusted temporal hour by passing in {@link getSeaLevelSunrise() sea level sunrise} and
|
|
2702
|
+
* {@link getSeaLevelSunset() sea level sunset} as parameters.
|
|
2722
2703
|
*
|
|
2723
2704
|
* @param {Temporal.ZonedDateTime | null} startOfDay
|
|
2724
2705
|
* The start of the day.
|
|
@@ -2726,13 +2707,13 @@ class NOAACalculator {
|
|
|
2726
2707
|
* The end of the day.
|
|
2727
2708
|
*
|
|
2728
2709
|
* @return {number} the <code>long</code> millisecond length of the temporal hour. If the calculation can't be computed a
|
|
2729
|
-
*
|
|
2710
|
+
* `NaN` will be returned. See detailed explanation on top of the page.
|
|
2730
2711
|
*
|
|
2731
|
-
* @see
|
|
2712
|
+
* @see getTemporalHour()
|
|
2732
2713
|
*/
|
|
2733
2714
|
getTemporalHour(startOfDay = this.getSeaLevelSunrise(), endOfDay = this.getSeaLevelSunset()) {
|
|
2734
2715
|
if (startOfDay === null || endOfDay === null) {
|
|
2735
|
-
return
|
|
2716
|
+
return NaN;
|
|
2736
2717
|
}
|
|
2737
2718
|
const delta = endOfDay.epochMilliseconds - startOfDay.epochMilliseconds;
|
|
2738
2719
|
return Math.floor(delta / 12);
|
|
@@ -2769,7 +2750,7 @@ class NOAACalculator {
|
|
|
2769
2750
|
* @return {Temporal.ZonedDateTime | null} The Date.
|
|
2770
2751
|
*/
|
|
2771
2752
|
getDateFromTime(time, isSunrise) {
|
|
2772
|
-
if (
|
|
2753
|
+
if (isNaN(time)) {
|
|
2773
2754
|
return null;
|
|
2774
2755
|
}
|
|
2775
2756
|
let calculatedTime = time;
|
|
@@ -2794,7 +2775,7 @@ class NOAACalculator {
|
|
|
2794
2775
|
return cal
|
|
2795
2776
|
.toZonedDateTime({
|
|
2796
2777
|
timeZone: 'UTC',
|
|
2797
|
-
plainTime: new Temporal.PlainTime(hours, minutes, seconds, Math.trunc(calculatedTime * 1000)),
|
|
2778
|
+
plainTime: new temporalPolyfill.Temporal.PlainTime(hours, minutes, seconds, Math.trunc(calculatedTime * 1000)),
|
|
2798
2779
|
})
|
|
2799
2780
|
.withTimeZone(this.geoLocation.getTimeZone());
|
|
2800
2781
|
}
|
|
@@ -3014,8 +2995,7 @@ class NOAACalculator {
|
|
|
3014
2995
|
}
|
|
3015
2996
|
/**
|
|
3016
2997
|
* Returns the <a href="http://en.wikipedia.org/wiki/Hour_angle">hour angle</a> of the sun at sunset for the
|
|
3017
|
-
* latitude.
|
|
3018
|
-
* duplication of code.
|
|
2998
|
+
* latitude.
|
|
3019
2999
|
* @private
|
|
3020
3000
|
* @param {number} lat
|
|
3021
3001
|
* the latitude of observer in degrees
|
|
@@ -3186,40 +3166,6 @@ class NOAACalculator {
|
|
|
3186
3166
|
return timeUTC;
|
|
3187
3167
|
}
|
|
3188
3168
|
}
|
|
3189
|
-
exports.NOAACalculator = esm.NOAACalculator = NOAACalculator;
|
|
3190
|
-
/**
|
|
3191
|
-
* The zenith of astronomical sunrise and sunset. The sun is 90° from the vertical 0°
|
|
3192
|
-
* @private
|
|
3193
|
-
*/
|
|
3194
|
-
NOAACalculator.GEOMETRIC_ZENITH = 90;
|
|
3195
|
-
/**
|
|
3196
|
-
* Default value for Sun's zenith and true rise/set Zenith (used in this class and subclasses) is the angle that the
|
|
3197
|
-
* center of the Sun makes to a line perpendicular to the Earth's surface. If the Sun were a point and the Earth
|
|
3198
|
-
* were without an atmosphere, true sunset and sunrise would correspond to a 90° zenith. Because the Sun is not
|
|
3199
|
-
* a point, and because the atmosphere refracts light, this 90° zenith does not, in fact, correspond to true
|
|
3200
|
-
* sunset or sunrise, instead the center of the Sun's disk must lie just below the horizon for the upper edge to be
|
|
3201
|
-
* obscured. This means that a zenith of just above 90° must be used. The Sun subtends an angle of 16 minutes of
|
|
3202
|
-
* arc (this can be changed via the {@link #setSunRadius(double)} method , and atmospheric refraction accounts for
|
|
3203
|
-
* 34 minutes or so (this can be changed via the {@link #setRefraction(double)} method), giving a total of 50
|
|
3204
|
-
* arcminutes. The total value for ZENITH is 90+(5/6) or 90.8333333° for true sunrise/sunset.
|
|
3205
|
-
*/
|
|
3206
|
-
// const ZENITH: number = GEOMETRIC_ZENITH + 5.0 / 6.0;
|
|
3207
|
-
/** Sun's zenith at civil twilight (96°). */
|
|
3208
|
-
NOAACalculator.CIVIL_ZENITH = 96;
|
|
3209
|
-
/** Sun's zenith at nautical twilight (102°). */
|
|
3210
|
-
NOAACalculator.NAUTICAL_ZENITH = 102;
|
|
3211
|
-
/** Sun's zenith at astronomical twilight (108°). */
|
|
3212
|
-
NOAACalculator.ASTRONOMICAL_ZENITH = 108;
|
|
3213
|
-
/**
|
|
3214
|
-
* The <a href="http://en.wikipedia.org/wiki/Julian_day">Julian day</a> of January 1, 2000
|
|
3215
|
-
* @private
|
|
3216
|
-
*/
|
|
3217
|
-
NOAACalculator.JULIAN_DAY_JAN_1_2000 = 2451545;
|
|
3218
|
-
/**
|
|
3219
|
-
* Julian days per century
|
|
3220
|
-
* @private
|
|
3221
|
-
*/
|
|
3222
|
-
NOAACalculator.JULIAN_DAYS_PER_CENTURY = 36525;
|
|
3223
3169
|
|
|
3224
3170
|
/*
|
|
3225
3171
|
Hebcal - A Jewish Calendar Generator
|
|
@@ -3302,7 +3248,7 @@ function getFormatter$1(tzid) {
|
|
|
3302
3248
|
}
|
|
3303
3249
|
|
|
3304
3250
|
/** Class representing Location */
|
|
3305
|
-
class Location extends
|
|
3251
|
+
class Location extends GeoLocation {
|
|
3306
3252
|
/**
|
|
3307
3253
|
* Initialize a Location instance
|
|
3308
3254
|
* @param {number} latitude - Latitude as a decimal, valid range -90 thru +90 (e.g. 41.85003)
|
|
@@ -3564,10 +3510,6 @@ function m(){zr().Temporal=Ar,Intl.DateTimeFormat=kr,Date.prototype.toTemporalIn
|
|
|
3564
3510
|
|
|
3565
3511
|
m();
|
|
3566
3512
|
|
|
3567
|
-
var global$1 = /*#__PURE__*/Object.freeze({
|
|
3568
|
-
__proto__: null
|
|
3569
|
-
});
|
|
3570
|
-
|
|
3571
3513
|
/**
|
|
3572
3514
|
* @private
|
|
3573
3515
|
* @param {number} number
|
|
@@ -3641,7 +3583,7 @@ class Zmanim {
|
|
|
3641
3583
|
month: dt.getMonth() + 1,
|
|
3642
3584
|
day: dt.getDate()
|
|
3643
3585
|
});
|
|
3644
|
-
this.noaa = new
|
|
3586
|
+
this.noaa = new NOAACalculator(gloc, plainDate);
|
|
3645
3587
|
this.useElevation = Boolean(useElevation);
|
|
3646
3588
|
}
|
|
3647
3589
|
/**
|
|
@@ -3765,7 +3707,7 @@ class Zmanim {
|
|
|
3765
3707
|
const endOfDay = this.noaa.getSunset();
|
|
3766
3708
|
const temporalHour = this.noaa.getTemporalHour(startOfDay, endOfDay);
|
|
3767
3709
|
const offset = Math.round(temporalHour * hours);
|
|
3768
|
-
const zdt =
|
|
3710
|
+
const zdt = NOAACalculator.getTimeOffset(startOfDay, offset);
|
|
3769
3711
|
return zdtToDate(zdt);
|
|
3770
3712
|
}
|
|
3771
3713
|
/**
|
|
@@ -5984,7 +5926,7 @@ class DailyLearning {
|
|
|
5984
5926
|
}
|
|
5985
5927
|
}
|
|
5986
5928
|
|
|
5987
|
-
const version="5.0.0-
|
|
5929
|
+
const version="5.0.0-rc5";
|
|
5988
5930
|
|
|
5989
5931
|
const headers$1={"plural-forms":"nplurals=2; plural=(n > 1);"};const contexts$1={"":{Shabbat:["Shabbos"],"Achrei Mot":["Achrei Mos"],Bechukotai:["Bechukosai"],"Beha'alotcha":["Beha'aloscha"],Bereshit:["Bereshis"],Chukat:["Chukas"],"Erev Shavuot":["Erev Shavuos"],"Erev Sukkot":["Erev Sukkos"],"Ki Tavo":["Ki Savo"],"Ki Teitzei":["Ki Seitzei"],"Ki Tisa":["Ki Sisa"],Matot:["Matos"],"Purim Katan":["Purim Koton"],"Shabbat Chazon":["Shabbos Chazon"],"Shabbat HaChodesh":["Shabbos HaChodesh"],"Shabbat HaGadol":["Shabbos HaGadol"],"Shabbat Nachamu":["Shabbos Nachamu"],"Shabbat Parah":["Shabbos Parah"],"Shabbat Shekalim":["Shabbos Shekalim"],"Shabbat Shuva":["Shabbos Shuvah"],"Shabbat Zachor":["Shabbos Zachor"],Shavuot:["Shavuos"],"Shavuot I":["Shavuos I"],"Shavuot II":["Shavuos II"],Shemot:["Shemos"],"Shmini Atzeret":["Shmini Atzeres"],"Simchat Torah":["Simchas Torah"],Sukkot:["Sukkos"],"Sukkot I":["Sukkos I"],"Sukkot II":["Sukkos II"],"Sukkot II (CH''M)":["Sukkos II (CH''M)"],"Sukkot III (CH''M)":["Sukkos III (CH''M)"],"Sukkot IV (CH''M)":["Sukkos IV (CH''M)"],"Sukkot V (CH''M)":["Sukkos V (CH''M)"],"Sukkot VI (CH''M)":["Sukkos VI (CH''M)"],"Sukkot VII (Hoshana Raba)":["Sukkos VII (Hoshana Raba)"],"Ta'anit Bechorot":["Ta'anis Bechoros"],"Ta'anit Esther":["Ta'anis Esther"],Toldot:["Toldos"],Vaetchanan:["Vaeschanan"],Yitro:["Yisro"],"Vezot Haberakhah":["Vezos Haberakhah"],Parashat:["Parshas"],"Leil Selichot":["Leil Selichos"],"Shabbat Mevarchim Chodesh":["Shabbos Mevorchim Chodesh"],"Shabbat Shirah":["Shabbos Shirah"],Tevet:["Teves"],"Asara B'Tevet":["Asara B'Teves"],"Alot HaShachar":["Alos HaShachar"],"Kriat Shema, sof zeman":["Krias Shema, sof zman"],"Tefilah, sof zeman":["Tefilah, sof zman"],"Kriat Shema, sof zeman (MGA)":["Krias Shema, sof zman (MGA)"],"Tefilah, sof zeman (MGA)":["Tefilah, sof zman (MGA)"],"Chatzot HaLailah":["Chatzos HaLailah"],"Chatzot hayom":["Chatzos"],"Tzeit HaKochavim":["Tzeis HaKochavim"],"Birkat Hachamah":["Birkas Hachamah"],"Shushan Purim Katan":["Shushan Purim Koton"]}};var poAshkenazi = {headers:headers$1,contexts:contexts$1};
|
|
5990
5932
|
|
|
@@ -6917,7 +6859,10 @@ class HebrewCalendar {
|
|
|
6917
6859
|
* @return {HDate} anniversary occurring in `hyear`
|
|
6918
6860
|
*/
|
|
6919
6861
|
static getBirthdayOrAnniversary(hyear, gdate) {
|
|
6920
|
-
const dt =
|
|
6862
|
+
const dt = getBirthdayHD(hyear, gdate);
|
|
6863
|
+
if (typeof dt === 'undefined') {
|
|
6864
|
+
return dt;
|
|
6865
|
+
}
|
|
6921
6866
|
return new HDate(dt);
|
|
6922
6867
|
}
|
|
6923
6868
|
|
|
@@ -6956,7 +6901,10 @@ class HebrewCalendar {
|
|
|
6956
6901
|
* @return {HDate} anniversary occurring in hyear
|
|
6957
6902
|
*/
|
|
6958
6903
|
static getYahrzeit(hyear, gdate) {
|
|
6959
|
-
const dt =
|
|
6904
|
+
const dt = getYahrzeitHD(hyear, gdate);
|
|
6905
|
+
if (typeof dt === 'undefined') {
|
|
6906
|
+
return dt;
|
|
6907
|
+
}
|
|
6960
6908
|
return new HDate(dt);
|
|
6961
6909
|
}
|
|
6962
6910
|
|
|
@@ -7183,6 +7131,7 @@ exports.AsaraBTevetEvent = AsaraBTevetEvent;
|
|
|
7183
7131
|
exports.CandleLightingEvent = CandleLightingEvent;
|
|
7184
7132
|
exports.DailyLearning = DailyLearning;
|
|
7185
7133
|
exports.Event = Event;
|
|
7134
|
+
exports.GeoLocation = GeoLocation;
|
|
7186
7135
|
exports.HDate = HDate;
|
|
7187
7136
|
exports.HavdalahEvent = HavdalahEvent;
|
|
7188
7137
|
exports.HebrewCalendar = HebrewCalendar;
|
|
@@ -7193,6 +7142,7 @@ exports.Location = Location;
|
|
|
7193
7142
|
exports.MevarchimChodeshEvent = MevarchimChodeshEvent;
|
|
7194
7143
|
exports.Molad = Molad;
|
|
7195
7144
|
exports.MoladEvent = MoladEvent;
|
|
7145
|
+
exports.NOAACalculator = NOAACalculator;
|
|
7196
7146
|
exports.OmerEvent = OmerEvent;
|
|
7197
7147
|
exports.ParshaEvent = ParshaEvent;
|
|
7198
7148
|
exports.RoshChodeshEvent = RoshChodeshEvent;
|