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