@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/bundle.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @hebcal/core v5.0.0-
|
|
2
|
-
var hebcal = (function (exports) {
|
|
1
|
+
/*! @hebcal/core v5.0.0-rc5 */
|
|
2
|
+
var hebcal = (function (exports, temporalPolyfill) {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
5
|
const GERESH = '׳';
|
|
@@ -886,46 +886,6 @@ function toSimpleHebrewDate(obj) {
|
|
|
886
886
|
throw new TypeError(`Argument not a Date: ${obj}`);
|
|
887
887
|
}
|
|
888
888
|
}
|
|
889
|
-
/**
|
|
890
|
-
* Calculates yahrzeit.
|
|
891
|
-
* `hyear` must be after original `date` of death.
|
|
892
|
-
* Returns `undefined` when requested year preceeds or is same as original year.
|
|
893
|
-
*
|
|
894
|
-
* Hebcal uses the algorithm defined in "Calendrical Calculations"
|
|
895
|
-
* by Edward M. Reingold and Nachum Dershowitz.
|
|
896
|
-
*
|
|
897
|
-
* The customary anniversary date of a death is more complicated and depends
|
|
898
|
-
* also on the character of the year in which the first anniversary occurs.
|
|
899
|
-
* There are several cases:
|
|
900
|
-
*
|
|
901
|
-
* * If the date of death is Marcheshvan 30, the anniversary in general depends
|
|
902
|
-
* on the first anniversary; if that first anniversary was not Marcheshvan 30,
|
|
903
|
-
* use the day before Kislev 1.
|
|
904
|
-
* * If the date of death is Kislev 30, the anniversary in general again depends
|
|
905
|
-
* on the first anniversary — if that was not Kislev 30, use the day before
|
|
906
|
-
* Tevet 1.
|
|
907
|
-
* * If the date of death is Adar II, the anniversary is the same day in the
|
|
908
|
-
* last month of the Hebrew year (Adar or Adar II).
|
|
909
|
-
* * If the date of death is Adar I 30, the anniversary in a Hebrew year that
|
|
910
|
-
* is not a leap year (in which Adar only has 29 days) is the last day in
|
|
911
|
-
* Shevat.
|
|
912
|
-
* * In all other cases, use the normal (that is, same month number) anniversary
|
|
913
|
-
* of the date of death. [Calendrical Calculations p. 113]
|
|
914
|
-
* @example
|
|
915
|
-
* import {getYahrzeit} from '@hebcal/hdate';
|
|
916
|
-
* const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
|
|
917
|
-
* const anniversary = getYahrzeit(5780, dt); // '2/25/2020' == '30 Sh\'vat 5780'
|
|
918
|
-
* @param {number} hyear Hebrew year
|
|
919
|
-
* @param {Date | SimpleHebrewDate | number} date Gregorian or Hebrew date of death
|
|
920
|
-
* @return {Date} anniversary occurring in `hyear`
|
|
921
|
-
*/
|
|
922
|
-
function getYahrzeit(hyear, date) {
|
|
923
|
-
const hd = getYahrzeitHD(hyear, date);
|
|
924
|
-
if (typeof hd === 'undefined') {
|
|
925
|
-
return hd;
|
|
926
|
-
}
|
|
927
|
-
return exports.greg.abs2greg(hebrew2abs(hd.yy, hd.mm, hd.dd));
|
|
928
|
-
}
|
|
929
889
|
function getYahrzeitHD(hyear, date) {
|
|
930
890
|
let hDeath = toSimpleHebrewDate(date);
|
|
931
891
|
if (hyear <= hDeath.yy) {
|
|
@@ -961,38 +921,6 @@ function getYahrzeitHD(hyear, date) {
|
|
|
961
921
|
hDeath.yy = hyear;
|
|
962
922
|
return hDeath;
|
|
963
923
|
}
|
|
964
|
-
/**
|
|
965
|
-
* Calculates a birthday or anniversary (non-yahrzeit).
|
|
966
|
-
* `hyear` must be after original `date` of anniversary.
|
|
967
|
-
* Returns `undefined` when requested year preceeds or is same as original year.
|
|
968
|
-
*
|
|
969
|
-
* Hebcal uses the algorithm defined in "Calendrical Calculations"
|
|
970
|
-
* by Edward M. Reingold and Nachum Dershowitz.
|
|
971
|
-
*
|
|
972
|
-
* The birthday of someone born in Adar of an ordinary year or Adar II of
|
|
973
|
-
* a leap year is also always in the last month of the year, be that Adar
|
|
974
|
-
* or Adar II. The birthday in an ordinary year of someone born during the
|
|
975
|
-
* first 29 days of Adar I in a leap year is on the corresponding day of Adar;
|
|
976
|
-
* in a leap year, the birthday occurs in Adar I, as expected.
|
|
977
|
-
*
|
|
978
|
-
* Someone born on the thirtieth day of Marcheshvan, Kislev, or Adar I
|
|
979
|
-
* has his birthday postponed until the first of the following month in
|
|
980
|
-
* years where that day does not occur. [Calendrical Calculations p. 111]
|
|
981
|
-
* @example
|
|
982
|
-
* import {getBirthdayOrAnniversary} from '@hebcal/hdate';
|
|
983
|
-
* const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
|
|
984
|
-
* const anniversary = getBirthdayOrAnniversary(5780, dt); // '3/26/2020' == '1 Nisan 5780'
|
|
985
|
-
* @param {number} hyear Hebrew year
|
|
986
|
-
* @param {Date | SimpleHebrewDate | number} date Gregorian or Hebrew date of event
|
|
987
|
-
* @return {Date} anniversary occurring in `hyear`
|
|
988
|
-
*/
|
|
989
|
-
function getBirthdayOrAnniversary(hyear, date) {
|
|
990
|
-
const hd = getBirthdayHD(hyear, date);
|
|
991
|
-
if (typeof hd === 'undefined') {
|
|
992
|
-
return hd;
|
|
993
|
-
}
|
|
994
|
-
return exports.greg.abs2greg(hebrew2abs(hd.yy, hd.mm, hd.dd));
|
|
995
|
-
}
|
|
996
924
|
function getBirthdayHD(hyear, date) {
|
|
997
925
|
const orig = toSimpleHebrewDate(date);
|
|
998
926
|
const origYear = orig.yy;
|
|
@@ -1143,11 +1071,11 @@ class HDate {
|
|
|
1143
1071
|
this.setDate(day);
|
|
1144
1072
|
} else {
|
|
1145
1073
|
// 0 arguments
|
|
1146
|
-
if (typeof day === 'undefined') {
|
|
1074
|
+
if (typeof day === 'undefined' || day === null) {
|
|
1147
1075
|
day = new Date();
|
|
1148
1076
|
}
|
|
1149
1077
|
// 1 argument
|
|
1150
|
-
const abs0 = typeof day === 'number' && !isNaN(day) ? day : exports.greg.isDate(day) ? exports.greg.greg2abs(day) :
|
|
1078
|
+
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}`);
|
|
1151
1079
|
const isNumber = typeof abs0 === 'number';
|
|
1152
1080
|
const d = isNumber ? abs2hebrew(abs0) : abs0;
|
|
1153
1081
|
/**
|
|
@@ -2062,46 +1990,6 @@ class HebrewDateEvent extends Event {
|
|
|
2062
1990
|
}
|
|
2063
1991
|
}
|
|
2064
1992
|
|
|
2065
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
2066
|
-
|
|
2067
|
-
var esm = {};
|
|
2068
|
-
|
|
2069
|
-
var __awaiter = commonjsGlobal && commonjsGlobal.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
2070
|
-
function adopt(value) {
|
|
2071
|
-
return value instanceof P ? value : new P(function (resolve) {
|
|
2072
|
-
resolve(value);
|
|
2073
|
-
});
|
|
2074
|
-
}
|
|
2075
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
2076
|
-
function fulfilled(value) {
|
|
2077
|
-
try {
|
|
2078
|
-
step(generator.next(value));
|
|
2079
|
-
} catch (e) {
|
|
2080
|
-
reject(e);
|
|
2081
|
-
}
|
|
2082
|
-
}
|
|
2083
|
-
function rejected(value) {
|
|
2084
|
-
try {
|
|
2085
|
-
step(generator["throw"](value));
|
|
2086
|
-
} catch (e) {
|
|
2087
|
-
reject(e);
|
|
2088
|
-
}
|
|
2089
|
-
}
|
|
2090
|
-
function step(result) {
|
|
2091
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
2092
|
-
}
|
|
2093
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
2094
|
-
});
|
|
2095
|
-
};
|
|
2096
|
-
Object.defineProperty(esm, "__esModule", {
|
|
2097
|
-
value: true
|
|
2098
|
-
});
|
|
2099
|
-
exports.NOAACalculator = esm.NOAACalculator = exports.GeoLocation = esm.GeoLocation = void 0;
|
|
2100
|
-
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
2101
|
-
if (typeof Temporal !== 'function') {
|
|
2102
|
-
yield Promise.resolve().then(function () { return global$d; });
|
|
2103
|
-
}
|
|
2104
|
-
}))();
|
|
2105
1993
|
/**
|
|
2106
1994
|
* java.lang.Math.toRadians
|
|
2107
1995
|
* @private
|
|
@@ -2118,12 +2006,9 @@ function degreesToRadians(degrees) {
|
|
|
2118
2006
|
function radiansToDegrees(radians) {
|
|
2119
2007
|
return radians * 180 / Math.PI;
|
|
2120
2008
|
}
|
|
2121
|
-
const Long_MIN_VALUE = NaN;
|
|
2122
2009
|
/**
|
|
2123
2010
|
* A class that contains location information such as latitude and longitude required for astronomical calculations. The
|
|
2124
|
-
* elevation field may not be used by some calculation engines and would be ignored if set.
|
|
2125
|
-
* specific implementations of the {@link AstronomicalCalculator} to see if elevation is calculated as part of the
|
|
2126
|
-
* algorithm.
|
|
2011
|
+
* elevation field may not be used by some calculation engines and would be ignored if set.
|
|
2127
2012
|
*
|
|
2128
2013
|
* @author © Eliyahu Hershfeld 2004 - 2016
|
|
2129
2014
|
* @version 1.1
|
|
@@ -2147,25 +2032,33 @@ class GeoLocation {
|
|
|
2147
2032
|
* @param {string} timeZoneId
|
|
2148
2033
|
* the <code>TimeZone</code> for the location.
|
|
2149
2034
|
*/
|
|
2150
|
-
constructor(name, latitude, longitude,
|
|
2151
|
-
/**
|
|
2152
|
-
* @private
|
|
2153
|
-
* @see #getLocationName()
|
|
2154
|
-
* @see #setLocationName(String)
|
|
2155
|
-
*/
|
|
2156
|
-
this.locationName = null;
|
|
2157
|
-
let elevation = 0;
|
|
2158
|
-
if (timeZoneId) {
|
|
2159
|
-
elevation = elevationOrTimeZoneId;
|
|
2160
|
-
} else {
|
|
2161
|
-
timeZoneId = elevationOrTimeZoneId;
|
|
2162
|
-
}
|
|
2035
|
+
constructor(name, latitude, longitude, elevation, timeZoneId) {
|
|
2163
2036
|
this.setLocationName(name);
|
|
2164
2037
|
this.setLatitude(latitude);
|
|
2165
2038
|
this.setLongitude(longitude);
|
|
2166
2039
|
this.setElevation(elevation);
|
|
2167
2040
|
this.setTimeZone(timeZoneId);
|
|
2168
2041
|
}
|
|
2042
|
+
/**
|
|
2043
|
+
* @private
|
|
2044
|
+
*/
|
|
2045
|
+
latitude;
|
|
2046
|
+
/**
|
|
2047
|
+
* @private
|
|
2048
|
+
*/
|
|
2049
|
+
longitude;
|
|
2050
|
+
/**
|
|
2051
|
+
* @private
|
|
2052
|
+
*/
|
|
2053
|
+
locationName = null;
|
|
2054
|
+
/**
|
|
2055
|
+
* @private
|
|
2056
|
+
*/
|
|
2057
|
+
timeZoneId;
|
|
2058
|
+
/**
|
|
2059
|
+
* @private
|
|
2060
|
+
*/
|
|
2061
|
+
elevation;
|
|
2169
2062
|
/**
|
|
2170
2063
|
* Method to get the elevation in Meters.
|
|
2171
2064
|
*
|
|
@@ -2178,9 +2071,13 @@ class GeoLocation {
|
|
|
2178
2071
|
* Method to set the elevation in Meters <b>above </b> sea level.
|
|
2179
2072
|
*
|
|
2180
2073
|
* @param {number} elevation
|
|
2181
|
-
* The elevation to set in Meters. An
|
|
2074
|
+
* The elevation to set in Meters. An Error will be thrown if the value is a negative.
|
|
2182
2075
|
*/
|
|
2183
2076
|
setElevation(elevation) {
|
|
2077
|
+
if (typeof elevation !== 'number') throw new TypeError('Invalid elevation');
|
|
2078
|
+
if (elevation < 0) {
|
|
2079
|
+
throw new RangeError(`elevation ${elevation} must be zero or positive`);
|
|
2080
|
+
}
|
|
2184
2081
|
this.elevation = elevation;
|
|
2185
2082
|
}
|
|
2186
2083
|
setLatitude(latitude) {
|
|
@@ -2229,21 +2126,14 @@ class GeoLocation {
|
|
|
2229
2126
|
return this.timeZoneId;
|
|
2230
2127
|
}
|
|
2231
2128
|
/**
|
|
2232
|
-
* Method to set the TimeZone.
|
|
2233
|
-
*
|
|
2234
|
-
* {@link AstronomicalCalendar#getCalendar()}.
|
|
2235
|
-
* {@link java.util.Calendar#setTimeZone(TimeZone) setTimeZone(TimeZone)} be called in order for the
|
|
2236
|
-
* AstronomicalCalendar to output times in the expected offset. This situation will arise if the
|
|
2237
|
-
* AstronomicalCalendar is ever {@link AstronomicalCalendar#clone() cloned}.
|
|
2238
|
-
*
|
|
2239
|
-
* @param {string} timeZone
|
|
2129
|
+
* Method to set the TimeZone.
|
|
2130
|
+
* @param {string} timeZoneId
|
|
2240
2131
|
* The timeZone to set.
|
|
2241
2132
|
*/
|
|
2242
2133
|
setTimeZone(timeZoneId) {
|
|
2243
2134
|
this.timeZoneId = timeZoneId;
|
|
2244
2135
|
}
|
|
2245
2136
|
}
|
|
2246
|
-
exports.GeoLocation = esm.GeoLocation = GeoLocation;
|
|
2247
2137
|
/**
|
|
2248
2138
|
* The commonly used average solar refraction. Calendrical Calculations lists a more accurate global average of
|
|
2249
2139
|
* 34.478885263888294
|
|
@@ -2278,42 +2168,71 @@ const earthRadius = 6356.9; // in KM
|
|
|
2278
2168
|
class NOAACalculator {
|
|
2279
2169
|
/**
|
|
2280
2170
|
* A constructor that takes in <a href="http://en.wikipedia.org/wiki/Geolocation">geolocation</a> information as a
|
|
2281
|
-
* parameter.
|
|
2282
|
-
* calculations is the the {@link NOAACalculator}.
|
|
2171
|
+
* parameter.
|
|
2283
2172
|
*
|
|
2284
2173
|
* @param {GeoLocation} geoLocation
|
|
2285
2174
|
* The location information used for calculating astronomical sun times.
|
|
2286
2175
|
* @param {Temporal.PlainDate} date
|
|
2287
|
-
*
|
|
2288
|
-
* @see #setAstronomicalCalculator(AstronomicalCalculator) for changing the calculator class.
|
|
2289
2176
|
*/
|
|
2290
2177
|
constructor(geoLocation, date) {
|
|
2291
2178
|
this.date = date;
|
|
2292
2179
|
this.geoLocation = geoLocation;
|
|
2293
2180
|
}
|
|
2181
|
+
/**
|
|
2182
|
+
* The zenith of astronomical sunrise and sunset. The sun is 90° from the vertical 0°
|
|
2183
|
+
* @private
|
|
2184
|
+
*/
|
|
2185
|
+
static GEOMETRIC_ZENITH = 90;
|
|
2186
|
+
/**
|
|
2187
|
+
* Default value for Sun's zenith and true rise/set Zenith (used in this class and subclasses) is the angle that the
|
|
2188
|
+
* center of the Sun makes to a line perpendicular to the Earth's surface. If the Sun were a point and the Earth
|
|
2189
|
+
* were without an atmosphere, true sunset and sunrise would correspond to a 90° zenith. Because the Sun is not
|
|
2190
|
+
* a point, and because the atmosphere refracts light, this 90° zenith does not, in fact, correspond to true
|
|
2191
|
+
* sunset or sunrise, instead the center of the Sun's disk must lie just below the horizon for the upper edge to be
|
|
2192
|
+
* obscured. This means that a zenith of just above 90° must be used. The Sun subtends an angle of 16 minutes of
|
|
2193
|
+
* arc, and atmospheric refraction accounts for
|
|
2194
|
+
* 34 minutes or so, giving a total of 50
|
|
2195
|
+
* arcminutes. The total value for ZENITH is 90+(5/6) or 90.8333333° for true sunrise/sunset.
|
|
2196
|
+
*/
|
|
2197
|
+
// const ZENITH: number = GEOMETRIC_ZENITH + 5.0 / 6.0;
|
|
2198
|
+
/** Sun's zenith at civil twilight (96°). */
|
|
2199
|
+
static CIVIL_ZENITH = 96;
|
|
2200
|
+
/** Sun's zenith at nautical twilight (102°). */
|
|
2201
|
+
static NAUTICAL_ZENITH = 102;
|
|
2202
|
+
/** Sun's zenith at astronomical twilight (108°). */
|
|
2203
|
+
static ASTRONOMICAL_ZENITH = 108;
|
|
2204
|
+
/**
|
|
2205
|
+
* The Java Calendar encapsulated by this class to track the current date used by the class
|
|
2206
|
+
* @private
|
|
2207
|
+
*/
|
|
2208
|
+
date;
|
|
2209
|
+
/**
|
|
2210
|
+
* the {@link GeoLocation} used for calculations.
|
|
2211
|
+
* @private
|
|
2212
|
+
*/
|
|
2213
|
+
geoLocation;
|
|
2294
2214
|
/**
|
|
2295
2215
|
* The getSunrise method Returns a `Date` representing the
|
|
2296
|
-
* {@link
|
|
2297
|
-
* for the calculation uses {@link
|
|
2298
|
-
* {@link
|
|
2299
|
-
*
|
|
2300
|
-
* and 16 archminutes for the sun's radius for a total of {@link
|
|
2301
|
-
* See documentation for the specific implementation of the {@link AstronomicalCalculator} that you are using.
|
|
2216
|
+
* {@link getElevationAdjustment elevation adjusted} sunrise time. The zenith used
|
|
2217
|
+
* for the calculation uses {@link GEOMETRIC_ZENITH geometric zenith} of 90° plus
|
|
2218
|
+
* {@link getElevationAdjustment}. This is adjusted
|
|
2219
|
+
* to add approximately 50/60 of a degree to account for 34 archminutes of refraction
|
|
2220
|
+
* and 16 archminutes for the sun's radius for a total of {@link adjustZenith 90.83333°}.
|
|
2302
2221
|
*
|
|
2303
2222
|
* @return {Temporal.ZonedDateTime | null} the `Date` representing the exact sunrise time. If the calculation can't be computed such as
|
|
2304
2223
|
* in the Arctic Circle where there is at least one day a year where the sun does not rise, and one where it
|
|
2305
2224
|
* does not set, a null will be returned. See detailed explanation on top of the page.
|
|
2306
|
-
* @see
|
|
2307
|
-
* @see
|
|
2308
|
-
* @see
|
|
2225
|
+
* @see adjustZenith
|
|
2226
|
+
* @see getSeaLevelSunrise()
|
|
2227
|
+
* @see getUTCSunrise
|
|
2309
2228
|
*/
|
|
2310
2229
|
getSunrise() {
|
|
2311
2230
|
const sunrise = this.getUTCSunrise0(NOAACalculator.GEOMETRIC_ZENITH);
|
|
2312
|
-
if (
|
|
2231
|
+
if (isNaN(sunrise)) return null;
|
|
2313
2232
|
return this.getDateFromTime(sunrise, true);
|
|
2314
2233
|
}
|
|
2315
2234
|
/**
|
|
2316
|
-
* A method that returns the sunrise without {@link
|
|
2235
|
+
* A method that returns the sunrise without {@link getElevationAdjustment elevation
|
|
2317
2236
|
* adjustment}. Non-sunrise and sunset calculations such as dawn and dusk, depend on the amount of visible light,
|
|
2318
2237
|
* something that is not affected by elevation. This method returns sunrise calculated at sea level. This forms the
|
|
2319
2238
|
* base for dawn calculations that are calculated as a dip below the horizon before sunrise.
|
|
@@ -2321,54 +2240,54 @@ class NOAACalculator {
|
|
|
2321
2240
|
* @return {Temporal.ZonedDateTime | null} the `Date` representing the exact sea-level sunrise time. If the calculation can't be computed
|
|
2322
2241
|
* such as in the Arctic Circle where there is at least one day a year where the sun does not rise, and one
|
|
2323
2242
|
* where it does not set, a null will be returned. See detailed explanation on top of the page.
|
|
2324
|
-
* @see
|
|
2325
|
-
* @see
|
|
2326
|
-
* @see
|
|
2243
|
+
* @see getSunrise
|
|
2244
|
+
* @see getUTCSeaLevelSunrise
|
|
2245
|
+
* @see getSeaLevelSunset()
|
|
2327
2246
|
*/
|
|
2328
2247
|
getSeaLevelSunrise() {
|
|
2329
2248
|
const sunrise = this.getUTCSeaLevelSunrise(NOAACalculator.GEOMETRIC_ZENITH);
|
|
2330
|
-
if (
|
|
2249
|
+
if (isNaN(sunrise)) return null;
|
|
2331
2250
|
return this.getDateFromTime(sunrise, true);
|
|
2332
2251
|
}
|
|
2333
2252
|
/**
|
|
2334
|
-
* A method that returns the beginning of civil twilight (dawn) using a zenith of {@link
|
|
2253
|
+
* A method that returns the beginning of civil twilight (dawn) using a zenith of {@link CIVIL_ZENITH 96°}.
|
|
2335
2254
|
*
|
|
2336
2255
|
* @return {Temporal.ZonedDateTime | null} The `Date` of the beginning of civil twilight using a zenith of 96°. If the calculation
|
|
2337
2256
|
* can't be computed, null will be returned. See detailed explanation on top of the page.
|
|
2338
|
-
* @see
|
|
2257
|
+
* @see CIVIL_ZENITH
|
|
2339
2258
|
*/
|
|
2340
2259
|
getBeginCivilTwilight() {
|
|
2341
2260
|
return this.getSunriseOffsetByDegrees(NOAACalculator.CIVIL_ZENITH);
|
|
2342
2261
|
}
|
|
2343
2262
|
/**
|
|
2344
|
-
* A method that returns the beginning of nautical twilight using a zenith of {@link
|
|
2263
|
+
* A method that returns the beginning of nautical twilight using a zenith of {@link NAUTICAL_ZENITH 102°}.
|
|
2345
2264
|
*
|
|
2346
2265
|
* @return {Temporal.ZonedDateTime | null} The `Date` of the beginning of nautical twilight using a zenith of 102°. If the
|
|
2347
2266
|
* calculation can't be computed null will be returned. See detailed explanation on top of the page.
|
|
2348
|
-
* @see
|
|
2267
|
+
* @see NAUTICAL_ZENITH
|
|
2349
2268
|
*/
|
|
2350
2269
|
getBeginNauticalTwilight() {
|
|
2351
2270
|
return this.getSunriseOffsetByDegrees(NOAACalculator.NAUTICAL_ZENITH);
|
|
2352
2271
|
}
|
|
2353
2272
|
/**
|
|
2354
|
-
* A method that returns the beginning of astronomical twilight using a zenith of {@link
|
|
2273
|
+
* A method that returns the beginning of astronomical twilight using a zenith of {@link ASTRONOMICAL_ZENITH
|
|
2355
2274
|
* 108°}.
|
|
2356
2275
|
*
|
|
2357
2276
|
* @return {Temporal.ZonedDateTime | null} The `Date` of the beginning of astronomical twilight using a zenith of 108°. If the
|
|
2358
2277
|
* calculation can't be computed, null will be returned. See detailed explanation on top of the page.
|
|
2359
|
-
* @see
|
|
2278
|
+
* @see ASTRONOMICAL_ZENITH
|
|
2360
2279
|
*/
|
|
2361
2280
|
getBeginAstronomicalTwilight() {
|
|
2362
2281
|
return this.getSunriseOffsetByDegrees(NOAACalculator.ASTRONOMICAL_ZENITH);
|
|
2363
2282
|
}
|
|
2364
2283
|
/**
|
|
2365
2284
|
* The getSunset method Returns a `Date` representing the
|
|
2366
|
-
* {@link
|
|
2367
|
-
* the calculation uses {@link
|
|
2368
|
-
* {@link
|
|
2369
|
-
*
|
|
2370
|
-
* and 16 archminutes for the sun's radius for a total of {@link
|
|
2371
|
-
*
|
|
2285
|
+
* {@link getElevationAdjustment elevation adjusted} sunset time. The zenith used for
|
|
2286
|
+
* the calculation uses {@link GEOMETRIC_ZENITH geometric zenith} of 90° plus
|
|
2287
|
+
* {@link getElevationAdjustment}. This is adjusted
|
|
2288
|
+
* to add approximately 50/60 of a degree to account for 34 archminutes of refraction
|
|
2289
|
+
* and 16 archminutes for the sun's radius for a total of {@link adjustZenith 90.83333°}.
|
|
2290
|
+
* Note:
|
|
2372
2291
|
* In certain cases the calculates sunset will occur before sunrise. This will typically happen when a timezone
|
|
2373
2292
|
* other than the local timezone is used (calculating Los Angeles sunset using a GMT timezone for example). In this
|
|
2374
2293
|
* case the sunset date will be incremented to the following date.
|
|
@@ -2376,17 +2295,17 @@ class NOAACalculator {
|
|
|
2376
2295
|
* @return {Temporal.ZonedDateTime | null} The `Date` representing the exact sunset time. If the calculation can't be computed such as in
|
|
2377
2296
|
* the Arctic Circle where there is at least one day a year where the sun does not rise, and one where it
|
|
2378
2297
|
* does not set, a null will be returned. See detailed explanation on top of the page.
|
|
2379
|
-
* @see
|
|
2380
|
-
* @see
|
|
2381
|
-
* @see
|
|
2298
|
+
* @see adjustZenith
|
|
2299
|
+
* @see getSeaLevelSunset()
|
|
2300
|
+
* @see getUTCSunset
|
|
2382
2301
|
*/
|
|
2383
2302
|
getSunset() {
|
|
2384
2303
|
const sunset = this.getUTCSunset0(NOAACalculator.GEOMETRIC_ZENITH);
|
|
2385
|
-
if (
|
|
2304
|
+
if (isNaN(sunset)) return null;
|
|
2386
2305
|
return this.getDateFromTime(sunset, false);
|
|
2387
2306
|
}
|
|
2388
2307
|
/**
|
|
2389
|
-
* A method that returns the sunset without {@link
|
|
2308
|
+
* A method that returns the sunset without {@link getElevationAdjustment elevation
|
|
2390
2309
|
* adjustment}. Non-sunrise and sunset calculations such as dawn and dusk, depend on the amount of visible light,
|
|
2391
2310
|
* something that is not affected by elevation. This method returns sunset calculated at sea level. This forms the
|
|
2392
2311
|
* base for dusk calculations that are calculated as a dip below the horizon after sunset.
|
|
@@ -2394,42 +2313,42 @@ class NOAACalculator {
|
|
|
2394
2313
|
* @return {Temporal.ZonedDateTime | null} The `Date` representing the exact sea-level sunset time. If the calculation can't be computed
|
|
2395
2314
|
* such as in the Arctic Circle where there is at least one day a year where the sun does not rise, and one
|
|
2396
2315
|
* where it does not set, a null will be returned. See detailed explanation on top of the page.
|
|
2397
|
-
* @see
|
|
2398
|
-
* @see
|
|
2316
|
+
* @see getSunset
|
|
2317
|
+
* @see getUTCSeaLevelSunset
|
|
2399
2318
|
*/
|
|
2400
2319
|
getSeaLevelSunset() {
|
|
2401
2320
|
const sunset = this.getUTCSeaLevelSunset(NOAACalculator.GEOMETRIC_ZENITH);
|
|
2402
|
-
if (
|
|
2321
|
+
if (isNaN(sunset)) return null;
|
|
2403
2322
|
return this.getDateFromTime(sunset, false);
|
|
2404
2323
|
}
|
|
2405
2324
|
/**
|
|
2406
|
-
* A method that returns the end of civil twilight using a zenith of {@link
|
|
2325
|
+
* A method that returns the end of civil twilight using a zenith of {@link CIVIL_ZENITH 96°}.
|
|
2407
2326
|
*
|
|
2408
|
-
* @return {Temporal.ZonedDateTime | null} The `Date` of the end of civil twilight using a zenith of {@link
|
|
2327
|
+
* @return {Temporal.ZonedDateTime | null} The `Date` of the end of civil twilight using a zenith of {@link CIVIL_ZENITH 96°}. If
|
|
2409
2328
|
* the calculation can't be computed, null will be returned. See detailed explanation on top of the page.
|
|
2410
|
-
* @see
|
|
2329
|
+
* @see CIVIL_ZENITH
|
|
2411
2330
|
*/
|
|
2412
2331
|
getEndCivilTwilight() {
|
|
2413
2332
|
return this.getSunsetOffsetByDegrees(NOAACalculator.CIVIL_ZENITH);
|
|
2414
2333
|
}
|
|
2415
2334
|
/**
|
|
2416
|
-
* A method that returns the end of nautical twilight using a zenith of {@link
|
|
2335
|
+
* A method that returns the end of nautical twilight using a zenith of {@link NAUTICAL_ZENITH 102°}.
|
|
2417
2336
|
*
|
|
2418
|
-
* @return {Temporal.ZonedDateTime | null} The `Date` of the end of nautical twilight using a zenith of {@link
|
|
2337
|
+
* @return {Temporal.ZonedDateTime | null} The `Date` of the end of nautical twilight using a zenith of {@link NAUTICAL_ZENITH 102°}
|
|
2419
2338
|
* . If the calculation can't be computed, null will be returned. See detailed explanation on top of the
|
|
2420
2339
|
* page.
|
|
2421
|
-
* @see
|
|
2340
|
+
* @see NAUTICAL_ZENITH
|
|
2422
2341
|
*/
|
|
2423
2342
|
getEndNauticalTwilight() {
|
|
2424
2343
|
return this.getSunsetOffsetByDegrees(NOAACalculator.NAUTICAL_ZENITH);
|
|
2425
2344
|
}
|
|
2426
2345
|
/**
|
|
2427
|
-
* A method that returns the end of astronomical twilight using a zenith of {@link
|
|
2346
|
+
* A method that returns the end of astronomical twilight using a zenith of {@link ASTRONOMICAL_ZENITH 108°}.
|
|
2428
2347
|
*
|
|
2429
|
-
* @return {Temporal.ZonedDateTime | null} The `Date` of the end of astronomical twilight using a zenith of {@link
|
|
2348
|
+
* @return {Temporal.ZonedDateTime | null} The `Date` of the end of astronomical twilight using a zenith of {@link ASTRONOMICAL_ZENITH
|
|
2430
2349
|
* 108°}. If the calculation can't be computed, null will be returned. See detailed explanation on top
|
|
2431
2350
|
* of the page.
|
|
2432
|
-
* @see
|
|
2351
|
+
* @see ASTRONOMICAL_ZENITH
|
|
2433
2352
|
*/
|
|
2434
2353
|
getEndAstronomicalTwilight() {
|
|
2435
2354
|
return this.getSunsetOffsetByDegrees(NOAACalculator.ASTRONOMICAL_ZENITH);
|
|
@@ -2447,7 +2366,7 @@ class NOAACalculator {
|
|
|
2447
2366
|
* @return {Temporal.ZonedDateTime | null} the `Date` with the offset in milliseconds added to it
|
|
2448
2367
|
*/
|
|
2449
2368
|
static getTimeOffset(time, offset) {
|
|
2450
|
-
if (time === null ||
|
|
2369
|
+
if (time === null || isNaN(offset)) {
|
|
2451
2370
|
return null;
|
|
2452
2371
|
}
|
|
2453
2372
|
return time.add({
|
|
@@ -2456,41 +2375,41 @@ class NOAACalculator {
|
|
|
2456
2375
|
}
|
|
2457
2376
|
/**
|
|
2458
2377
|
* A utility method that returns the time of an offset by degrees below or above the horizon of
|
|
2459
|
-
* {@link
|
|
2460
|
-
* before sunrise, an offset of 14 + {@link
|
|
2378
|
+
* {@link getSunrise() sunrise}. Note that the degree offset is from the vertical, so for a calculation of 14°
|
|
2379
|
+
* before sunrise, an offset of 14 + {@link GEOMETRIC_ZENITH} = 104 would have to be passed as a parameter.
|
|
2461
2380
|
*
|
|
2462
2381
|
* @param {number} offsetZenith
|
|
2463
|
-
* the degrees before {@link
|
|
2382
|
+
* the degrees before {@link getSunrise} to use in the calculation. For time after sunrise use
|
|
2464
2383
|
* negative numbers. Note that the degree offset is from the vertical, so for a calculation of 14°
|
|
2465
|
-
* before sunrise, an offset of 14 + {@link
|
|
2384
|
+
* before sunrise, an offset of 14 + {@link GEOMETRIC_ZENITH} = 104 would have to be passed as a
|
|
2466
2385
|
* parameter.
|
|
2467
|
-
* @return {Temporal.ZonedDateTime | null} The `Date` of the offset after (or before) {@link
|
|
2386
|
+
* @return {Temporal.ZonedDateTime | null} The `Date` of the offset after (or before) {@link getSunrise}. If the calculation
|
|
2468
2387
|
* can't be computed such as in the Arctic Circle where there is at least one day a year where the sun does
|
|
2469
2388
|
* not rise, and one where it does not set, a null will be returned. See detailed explanation on top of the
|
|
2470
2389
|
* page.
|
|
2471
2390
|
*/
|
|
2472
2391
|
getSunriseOffsetByDegrees(offsetZenith) {
|
|
2473
2392
|
const dawn = this.getUTCSunrise0(offsetZenith);
|
|
2474
|
-
if (
|
|
2393
|
+
if (isNaN(dawn)) return null;
|
|
2475
2394
|
return this.getDateFromTime(dawn, true);
|
|
2476
2395
|
}
|
|
2477
2396
|
/**
|
|
2478
|
-
* A utility method that returns the time of an offset by degrees below or above the horizon of {@link
|
|
2397
|
+
* A utility method that returns the time of an offset by degrees below or above the horizon of {@link getSunset()
|
|
2479
2398
|
* sunset}. Note that the degree offset is from the vertical, so for a calculation of 14° after sunset, an
|
|
2480
|
-
* offset of 14 + {@link
|
|
2399
|
+
* offset of 14 + {@link GEOMETRIC_ZENITH} = 104 would have to be passed as a parameter.
|
|
2481
2400
|
*
|
|
2482
2401
|
* @param {number} offsetZenith
|
|
2483
|
-
* the degrees after {@link
|
|
2402
|
+
* the degrees after {@link getSunset} to use in the calculation. For time before sunset use negative
|
|
2484
2403
|
* numbers. Note that the degree offset is from the vertical, so for a calculation of 14° after
|
|
2485
|
-
* sunset, an offset of 14 + {@link
|
|
2486
|
-
* @return {Temporal.ZonedDateTime | null} The `Date`of the offset after (or before) {@link
|
|
2404
|
+
* sunset, an offset of 14 + {@link GEOMETRIC_ZENITH} = 104 would have to be passed as a parameter.
|
|
2405
|
+
* @return {Temporal.ZonedDateTime | null} The `Date`of the offset after (or before) {@link getSunset}. If the calculation can't
|
|
2487
2406
|
* be computed such as in the Arctic Circle where there is at least one day a year where the sun does not
|
|
2488
2407
|
* rise, and one where it does not set, a null will be returned. See detailed explanation on top of the
|
|
2489
2408
|
* page.
|
|
2490
2409
|
*/
|
|
2491
2410
|
getSunsetOffsetByDegrees(offsetZenith) {
|
|
2492
2411
|
const sunset = this.getUTCSunset0(offsetZenith);
|
|
2493
|
-
if (
|
|
2412
|
+
if (isNaN(sunset)) return null;
|
|
2494
2413
|
return this.getDateFromTime(sunset, false);
|
|
2495
2414
|
}
|
|
2496
2415
|
/**
|
|
@@ -2501,7 +2420,7 @@ class NOAACalculator {
|
|
|
2501
2420
|
* the degrees below the horizon. For time after sunrise use negative numbers.
|
|
2502
2421
|
* @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
|
|
2503
2422
|
* Arctic Circle where there is at least one day a year where the sun does not rise, and one where it does
|
|
2504
|
-
* not set,
|
|
2423
|
+
* not set, `NaN` will be returned. See detailed explanation on top of the page.
|
|
2505
2424
|
*/
|
|
2506
2425
|
getUTCSunrise0(zenith) {
|
|
2507
2426
|
return this.getUTCSunrise(this.getAdjustedDate(), this.geoLocation, zenith, true);
|
|
@@ -2516,9 +2435,9 @@ class NOAACalculator {
|
|
|
2516
2435
|
* the degrees below the horizon. For time after sunrise use negative numbers.
|
|
2517
2436
|
* @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
|
|
2518
2437
|
* Arctic Circle where there is at least one day a year where the sun does not rise, and one where it does
|
|
2519
|
-
* not set,
|
|
2520
|
-
* @see
|
|
2521
|
-
* @see
|
|
2438
|
+
* not set, `NaN` will be returned. See detailed explanation on top of the page.
|
|
2439
|
+
* @see getUTCSunrise
|
|
2440
|
+
* @see getUTCSeaLevelSunset
|
|
2522
2441
|
*/
|
|
2523
2442
|
getUTCSeaLevelSunrise(zenith) {
|
|
2524
2443
|
return this.getUTCSunrise(this.getAdjustedDate(), this.geoLocation, zenith, false);
|
|
@@ -2531,8 +2450,8 @@ class NOAACalculator {
|
|
|
2531
2450
|
* the degrees below the horizon. For time after sunset use negative numbers.
|
|
2532
2451
|
* @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
|
|
2533
2452
|
* Arctic Circle where there is at least one day a year where the sun does not rise, and one where it does
|
|
2534
|
-
* not set,
|
|
2535
|
-
* @see
|
|
2453
|
+
* not set, `NaN` will be returned. See detailed explanation on top of the page.
|
|
2454
|
+
* @see getUTCSeaLevelSunset
|
|
2536
2455
|
*/
|
|
2537
2456
|
getUTCSunset0(zenith) {
|
|
2538
2457
|
return this.getUTCSunset(this.getAdjustedDate(), this.geoLocation, zenith, true);
|
|
@@ -2548,9 +2467,9 @@ class NOAACalculator {
|
|
|
2548
2467
|
* the degrees below the horizon. For time before sunset use negative numbers.
|
|
2549
2468
|
* @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
|
|
2550
2469
|
* Arctic Circle where there is at least one day a year where the sun does not rise, and one where it does
|
|
2551
|
-
* not set,
|
|
2552
|
-
* @see
|
|
2553
|
-
* @see
|
|
2470
|
+
* not set, `NaN` will be returned. See detailed explanation on top of the page.
|
|
2471
|
+
* @see getUTCSunset
|
|
2472
|
+
* @see getUTCSeaLevelSunrise
|
|
2554
2473
|
*/
|
|
2555
2474
|
getUTCSeaLevelSunset(zenith) {
|
|
2556
2475
|
return this.getUTCSunset(this.getAdjustedDate(), this.geoLocation, zenith, false);
|
|
@@ -2568,9 +2487,9 @@ class NOAACalculator {
|
|
|
2568
2487
|
* Method to return the adjustment to the zenith required to account for the elevation. Since a person at a higher
|
|
2569
2488
|
* elevation can see farther below the horizon, the calculation for sunrise / sunset is calculated below the horizon
|
|
2570
2489
|
* used at sea level. This is only used for sunrise and sunset and not times before or after it such as
|
|
2571
|
-
* {@link
|
|
2490
|
+
* {@link getBeginNauticalTwilight() nautical twilight} since those
|
|
2572
2491
|
* calculations are based on the level of available light at the given dip below the horizon, something that is not
|
|
2573
|
-
* affected by elevation, the adjustment should only made if the zenith == 90° {@link
|
|
2492
|
+
* affected by elevation, the adjustment should only made if the zenith == 90° {@link adjustZenith adjusted}
|
|
2574
2493
|
* for refraction and solar radius. The algorithm used is
|
|
2575
2494
|
*
|
|
2576
2495
|
* <pre>
|
|
@@ -2602,30 +2521,30 @@ class NOAACalculator {
|
|
|
2602
2521
|
* is not a point, and because the atmosphere refracts light, this 90° zenith does not, in fact, correspond to
|
|
2603
2522
|
* true sunset or sunrise, instead the centre of the Sun's disk must lie just below the horizon for the upper edge
|
|
2604
2523
|
* to be obscured. This means that a zenith of just above 90° must be used. The Sun subtends an angle of 16
|
|
2605
|
-
* minutes of arc
|
|
2606
|
-
* accounts for 34 minutes or so
|
|
2524
|
+
* minutes of arc, and atmospheric refraction
|
|
2525
|
+
* accounts for 34 minutes or so, giving a total
|
|
2607
2526
|
* of 50 arcminutes. The total value for ZENITH is 90+(5/6) or 90.8333333° for true sunrise/sunset. Since a
|
|
2608
2527
|
* person at an elevation can see blow the horizon of a person at sea level, this will also adjust the zenith to
|
|
2609
2528
|
* account for elevation if available. Note that this will only adjust the value if the zenith is exactly 90 degrees.
|
|
2610
2529
|
* For values below and above this no correction is done. As an example, astronomical twilight is when the sun is
|
|
2611
|
-
* 18° below the horizon or {@link
|
|
2530
|
+
* 18° below the horizon or {@link ASTRONOMICAL_ZENITH 108°
|
|
2612
2531
|
* below the zenith}. This is traditionally calculated with none of the above mentioned adjustments. The same goes
|
|
2613
2532
|
* for various <em>tzais</em> and <em>alos</em> times such as the
|
|
2614
2533
|
* {@link ZmanimCalendar#ZENITH_16_POINT_1 16.1°} dip used in
|
|
2615
|
-
* {@link ComplexZmanimCalendar#getAlos16Point1Degrees
|
|
2534
|
+
* {@link ComplexZmanimCalendar#getAlos16Point1Degrees}.
|
|
2616
2535
|
*
|
|
2617
2536
|
* @param {number} zenith
|
|
2618
|
-
* the azimuth below the vertical zenith of 90°. For sunset typically the {@link
|
|
2619
|
-
* zenith} used for the calculation uses geometric zenith of 90° and {@link
|
|
2537
|
+
* the azimuth below the vertical zenith of 90°. For sunset typically the {@link adjustZenith
|
|
2538
|
+
* zenith} used for the calculation uses geometric zenith of 90° and {@link adjustZenith adjusts}
|
|
2620
2539
|
* this slightly to account for solar refraction and the sun's radius. Another example would be
|
|
2621
|
-
* {@link
|
|
2622
|
-
* {@link
|
|
2540
|
+
* {@link getEndNauticalTwilight} that passes
|
|
2541
|
+
* {@link NAUTICAL_ZENITH} to this method.
|
|
2623
2542
|
* @param {number} elevation
|
|
2624
2543
|
* elevation in Meters.
|
|
2625
|
-
* @return {number} The zenith adjusted to include the
|
|
2626
|
-
*
|
|
2544
|
+
* @return {number} The zenith adjusted to include the sun's radius, refracton
|
|
2545
|
+
* and {@link getElevationAdjustment elevation} adjustment. This will only be adjusted for
|
|
2627
2546
|
* sunrise and sunset (if the zenith == 90°)
|
|
2628
|
-
* @see
|
|
2547
|
+
* @see getElevationAdjustment
|
|
2629
2548
|
*/
|
|
2630
2549
|
adjustZenith(zenith, elevation) {
|
|
2631
2550
|
let adjustedZenith = zenith;
|
|
@@ -2636,7 +2555,32 @@ class NOAACalculator {
|
|
|
2636
2555
|
return adjustedZenith;
|
|
2637
2556
|
}
|
|
2638
2557
|
/**
|
|
2639
|
-
*
|
|
2558
|
+
* The <a href="http://en.wikipedia.org/wiki/Julian_day">Julian day</a> of January 1, 2000
|
|
2559
|
+
* @private
|
|
2560
|
+
*/
|
|
2561
|
+
static JULIAN_DAY_JAN_1_2000 = 2451545;
|
|
2562
|
+
/**
|
|
2563
|
+
* Julian days per century
|
|
2564
|
+
* @private
|
|
2565
|
+
*/
|
|
2566
|
+
static JULIAN_DAYS_PER_CENTURY = 36525;
|
|
2567
|
+
/**
|
|
2568
|
+
* A method that calculates UTC sunrise as well as any time based on an angle above or below sunrise.
|
|
2569
|
+
* @param date
|
|
2570
|
+
* Used to calculate day of year.
|
|
2571
|
+
* @param geoLocation
|
|
2572
|
+
* The location information used for astronomical calculating sun times.
|
|
2573
|
+
* @param zenith
|
|
2574
|
+
* the azimuth below the vertical zenith of 90 degrees. for sunrise typically the {@link adjustZenith
|
|
2575
|
+
* zenith} used for the calculation uses geometric zenith of 90° and {@link adjustZenith adjusts}
|
|
2576
|
+
* this slightly to account for solar refraction and the sun's radius. Another example would be
|
|
2577
|
+
* {@link getBeginNauticalTwilight} that passes
|
|
2578
|
+
* {@link NAUTICAL_ZENITH} to this method.
|
|
2579
|
+
* @param adjustForElevation
|
|
2580
|
+
* Should the time be adjusted for elevation
|
|
2581
|
+
* @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
|
|
2582
|
+
* the calculation (expected behavior for some locations such as near the poles,
|
|
2583
|
+
* `NaN` will be returned.
|
|
2640
2584
|
*/
|
|
2641
2585
|
getUTCSunrise(date, geoLocation, zenith, adjustForElevation) {
|
|
2642
2586
|
const elevation = adjustForElevation ? geoLocation.getElevation() : 0;
|
|
@@ -2653,7 +2597,22 @@ class NOAACalculator {
|
|
|
2653
2597
|
return sunrise;
|
|
2654
2598
|
}
|
|
2655
2599
|
/**
|
|
2656
|
-
*
|
|
2600
|
+
* A method that calculates UTC sunset as well as any time based on an angle above or below sunset.
|
|
2601
|
+
* @param date
|
|
2602
|
+
* Used to calculate day of year.
|
|
2603
|
+
* @param geoLocation
|
|
2604
|
+
* The location information used for astronomical calculating sun times.
|
|
2605
|
+
* @param zenith
|
|
2606
|
+
* the azimuth below the vertical zenith of 90°. For sunset typically the {@link adjustZenith
|
|
2607
|
+
* zenith} used for the calculation uses geometric zenith of 90° and {@link adjustZenith adjusts}
|
|
2608
|
+
* this slightly to account for solar refraction and the sun's radius. Another example would be
|
|
2609
|
+
* {@link getEndNauticalTwilight} that passes
|
|
2610
|
+
* {@link NAUTICAL_ZENITH} to this method.
|
|
2611
|
+
* @param adjustForElevation
|
|
2612
|
+
* Should the time be adjusted for elevation
|
|
2613
|
+
* @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
|
|
2614
|
+
* the calculation (expected behavior for some locations such as near the poles,
|
|
2615
|
+
* `NaN` will be returned.
|
|
2657
2616
|
*/
|
|
2658
2617
|
getUTCSunset(date, geoLocation, zenith, adjustForElevation) {
|
|
2659
2618
|
const elevation = adjustForElevation ? geoLocation.getElevation() : 0;
|
|
@@ -2672,8 +2631,8 @@ class NOAACalculator {
|
|
|
2672
2631
|
/**
|
|
2673
2632
|
* A utility method that will allow the calculation of a temporal (solar) hour based on the sunrise and sunset
|
|
2674
2633
|
* passed as parameters to this method. An example of the use of this method would be the calculation of a
|
|
2675
|
-
* non-elevation adjusted temporal hour by passing in {@link
|
|
2676
|
-
* {@link
|
|
2634
|
+
* non-elevation adjusted temporal hour by passing in {@link getSeaLevelSunrise() sea level sunrise} and
|
|
2635
|
+
* {@link getSeaLevelSunset() sea level sunset} as parameters.
|
|
2677
2636
|
*
|
|
2678
2637
|
* @param {Temporal.ZonedDateTime | null} startOfDay
|
|
2679
2638
|
* The start of the day.
|
|
@@ -2681,15 +2640,15 @@ class NOAACalculator {
|
|
|
2681
2640
|
* The end of the day.
|
|
2682
2641
|
*
|
|
2683
2642
|
* @return {number} the <code>long</code> millisecond length of the temporal hour. If the calculation can't be computed a
|
|
2684
|
-
*
|
|
2643
|
+
* `NaN` will be returned. See detailed explanation on top of the page.
|
|
2685
2644
|
*
|
|
2686
|
-
* @see
|
|
2645
|
+
* @see getTemporalHour()
|
|
2687
2646
|
*/
|
|
2688
2647
|
getTemporalHour() {
|
|
2689
2648
|
let startOfDay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getSeaLevelSunrise();
|
|
2690
2649
|
let endOfDay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getSeaLevelSunset();
|
|
2691
2650
|
if (startOfDay === null || endOfDay === null) {
|
|
2692
|
-
return
|
|
2651
|
+
return NaN;
|
|
2693
2652
|
}
|
|
2694
2653
|
const delta = endOfDay.epochMilliseconds - startOfDay.epochMilliseconds;
|
|
2695
2654
|
return Math.floor(delta / 12);
|
|
@@ -2728,7 +2687,7 @@ class NOAACalculator {
|
|
|
2728
2687
|
* @return {Temporal.ZonedDateTime | null} The Date.
|
|
2729
2688
|
*/
|
|
2730
2689
|
getDateFromTime(time, isSunrise) {
|
|
2731
|
-
if (
|
|
2690
|
+
if (isNaN(time)) {
|
|
2732
2691
|
return null;
|
|
2733
2692
|
}
|
|
2734
2693
|
let calculatedTime = time;
|
|
@@ -2755,7 +2714,7 @@ class NOAACalculator {
|
|
|
2755
2714
|
}
|
|
2756
2715
|
return cal.toZonedDateTime({
|
|
2757
2716
|
timeZone: 'UTC',
|
|
2758
|
-
plainTime: new Temporal.PlainTime(hours, minutes, seconds, Math.trunc(calculatedTime * 1000))
|
|
2717
|
+
plainTime: new temporalPolyfill.Temporal.PlainTime(hours, minutes, seconds, Math.trunc(calculatedTime * 1000))
|
|
2759
2718
|
}).withTimeZone(this.geoLocation.getTimeZone());
|
|
2760
2719
|
}
|
|
2761
2720
|
/**
|
|
@@ -2960,8 +2919,7 @@ class NOAACalculator {
|
|
|
2960
2919
|
}
|
|
2961
2920
|
/**
|
|
2962
2921
|
* Returns the <a href="http://en.wikipedia.org/wiki/Hour_angle">hour angle</a> of the sun at sunset for the
|
|
2963
|
-
* latitude.
|
|
2964
|
-
* duplication of code.
|
|
2922
|
+
* latitude.
|
|
2965
2923
|
* @private
|
|
2966
2924
|
* @param {number} lat
|
|
2967
2925
|
* the latitude of observer in degrees
|
|
@@ -3122,40 +3080,6 @@ class NOAACalculator {
|
|
|
3122
3080
|
return timeUTC;
|
|
3123
3081
|
}
|
|
3124
3082
|
}
|
|
3125
|
-
exports.NOAACalculator = esm.NOAACalculator = NOAACalculator;
|
|
3126
|
-
/**
|
|
3127
|
-
* The zenith of astronomical sunrise and sunset. The sun is 90° from the vertical 0°
|
|
3128
|
-
* @private
|
|
3129
|
-
*/
|
|
3130
|
-
NOAACalculator.GEOMETRIC_ZENITH = 90;
|
|
3131
|
-
/**
|
|
3132
|
-
* Default value for Sun's zenith and true rise/set Zenith (used in this class and subclasses) is the angle that the
|
|
3133
|
-
* center of the Sun makes to a line perpendicular to the Earth's surface. If the Sun were a point and the Earth
|
|
3134
|
-
* were without an atmosphere, true sunset and sunrise would correspond to a 90° zenith. Because the Sun is not
|
|
3135
|
-
* a point, and because the atmosphere refracts light, this 90° zenith does not, in fact, correspond to true
|
|
3136
|
-
* sunset or sunrise, instead the center of the Sun's disk must lie just below the horizon for the upper edge to be
|
|
3137
|
-
* obscured. This means that a zenith of just above 90° must be used. The Sun subtends an angle of 16 minutes of
|
|
3138
|
-
* arc (this can be changed via the {@link #setSunRadius(double)} method , and atmospheric refraction accounts for
|
|
3139
|
-
* 34 minutes or so (this can be changed via the {@link #setRefraction(double)} method), giving a total of 50
|
|
3140
|
-
* arcminutes. The total value for ZENITH is 90+(5/6) or 90.8333333° for true sunrise/sunset.
|
|
3141
|
-
*/
|
|
3142
|
-
// const ZENITH: number = GEOMETRIC_ZENITH + 5.0 / 6.0;
|
|
3143
|
-
/** Sun's zenith at civil twilight (96°). */
|
|
3144
|
-
NOAACalculator.CIVIL_ZENITH = 96;
|
|
3145
|
-
/** Sun's zenith at nautical twilight (102°). */
|
|
3146
|
-
NOAACalculator.NAUTICAL_ZENITH = 102;
|
|
3147
|
-
/** Sun's zenith at astronomical twilight (108°). */
|
|
3148
|
-
NOAACalculator.ASTRONOMICAL_ZENITH = 108;
|
|
3149
|
-
/**
|
|
3150
|
-
* The <a href="http://en.wikipedia.org/wiki/Julian_day">Julian day</a> of January 1, 2000
|
|
3151
|
-
* @private
|
|
3152
|
-
*/
|
|
3153
|
-
NOAACalculator.JULIAN_DAY_JAN_1_2000 = 2451545;
|
|
3154
|
-
/**
|
|
3155
|
-
* Julian days per century
|
|
3156
|
-
* @private
|
|
3157
|
-
*/
|
|
3158
|
-
NOAACalculator.JULIAN_DAYS_PER_CENTURY = 36525;
|
|
3159
3083
|
|
|
3160
3084
|
/*
|
|
3161
3085
|
Hebcal - A Jewish Calendar Generator
|
|
@@ -3238,7 +3162,7 @@ function getFormatter$1(tzid) {
|
|
|
3238
3162
|
}
|
|
3239
3163
|
|
|
3240
3164
|
/** Class representing Location */
|
|
3241
|
-
class Location extends
|
|
3165
|
+
class Location extends GeoLocation {
|
|
3242
3166
|
/**
|
|
3243
3167
|
* Initialize a Location instance
|
|
3244
3168
|
* @param {number} latitude - Latitude as a decimal, valid range -90 thru +90 (e.g. 41.85003)
|
|
@@ -6731,10 +6655,6 @@ function m() {
|
|
|
6731
6655
|
|
|
6732
6656
|
m();
|
|
6733
6657
|
|
|
6734
|
-
var global$d = /*#__PURE__*/Object.freeze({
|
|
6735
|
-
__proto__: null
|
|
6736
|
-
});
|
|
6737
|
-
|
|
6738
6658
|
/**
|
|
6739
6659
|
* @private
|
|
6740
6660
|
* @param {number} number
|
|
@@ -6808,7 +6728,7 @@ class Zmanim {
|
|
|
6808
6728
|
month: dt.getMonth() + 1,
|
|
6809
6729
|
day: dt.getDate()
|
|
6810
6730
|
});
|
|
6811
|
-
this.noaa = new
|
|
6731
|
+
this.noaa = new NOAACalculator(gloc, plainDate);
|
|
6812
6732
|
this.useElevation = Boolean(useElevation);
|
|
6813
6733
|
}
|
|
6814
6734
|
/**
|
|
@@ -6932,7 +6852,7 @@ class Zmanim {
|
|
|
6932
6852
|
const endOfDay = this.noaa.getSunset();
|
|
6933
6853
|
const temporalHour = this.noaa.getTemporalHour(startOfDay, endOfDay);
|
|
6934
6854
|
const offset = Math.round(temporalHour * hours);
|
|
6935
|
-
const zdt =
|
|
6855
|
+
const zdt = NOAACalculator.getTimeOffset(startOfDay, offset);
|
|
6936
6856
|
return zdtToDate(zdt);
|
|
6937
6857
|
}
|
|
6938
6858
|
/**
|
|
@@ -8125,6 +8045,8 @@ class ParshaEvent extends Event {
|
|
|
8125
8045
|
}
|
|
8126
8046
|
}
|
|
8127
8047
|
|
|
8048
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
8049
|
+
|
|
8128
8050
|
var check = function (it) {
|
|
8129
8051
|
return it && it.Math === Math && it;
|
|
8130
8052
|
};
|
|
@@ -9884,7 +9806,7 @@ class DailyLearning {
|
|
|
9884
9806
|
}
|
|
9885
9807
|
}
|
|
9886
9808
|
|
|
9887
|
-
const version="5.0.0-
|
|
9809
|
+
const version="5.0.0-rc5";
|
|
9888
9810
|
|
|
9889
9811
|
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};
|
|
9890
9812
|
|
|
@@ -11330,7 +11252,10 @@ class HebrewCalendar {
|
|
|
11330
11252
|
* @return {HDate} anniversary occurring in `hyear`
|
|
11331
11253
|
*/
|
|
11332
11254
|
static getBirthdayOrAnniversary(hyear, gdate) {
|
|
11333
|
-
const dt =
|
|
11255
|
+
const dt = getBirthdayHD(hyear, gdate);
|
|
11256
|
+
if (typeof dt === 'undefined') {
|
|
11257
|
+
return dt;
|
|
11258
|
+
}
|
|
11334
11259
|
return new HDate(dt);
|
|
11335
11260
|
}
|
|
11336
11261
|
|
|
@@ -11369,7 +11294,10 @@ class HebrewCalendar {
|
|
|
11369
11294
|
* @return {HDate} anniversary occurring in hyear
|
|
11370
11295
|
*/
|
|
11371
11296
|
static getYahrzeit(hyear, gdate) {
|
|
11372
|
-
const dt =
|
|
11297
|
+
const dt = getYahrzeitHD(hyear, gdate);
|
|
11298
|
+
if (typeof dt === 'undefined') {
|
|
11299
|
+
return dt;
|
|
11300
|
+
}
|
|
11373
11301
|
return new HDate(dt);
|
|
11374
11302
|
}
|
|
11375
11303
|
|
|
@@ -11596,6 +11524,7 @@ exports.AsaraBTevetEvent = AsaraBTevetEvent;
|
|
|
11596
11524
|
exports.CandleLightingEvent = CandleLightingEvent;
|
|
11597
11525
|
exports.DailyLearning = DailyLearning;
|
|
11598
11526
|
exports.Event = Event;
|
|
11527
|
+
exports.GeoLocation = GeoLocation;
|
|
11599
11528
|
exports.HDate = HDate;
|
|
11600
11529
|
exports.HavdalahEvent = HavdalahEvent;
|
|
11601
11530
|
exports.HebrewCalendar = HebrewCalendar;
|
|
@@ -11606,6 +11535,7 @@ exports.Location = Location;
|
|
|
11606
11535
|
exports.MevarchimChodeshEvent = MevarchimChodeshEvent;
|
|
11607
11536
|
exports.Molad = Molad;
|
|
11608
11537
|
exports.MoladEvent = MoladEvent;
|
|
11538
|
+
exports.NOAACalculator = NOAACalculator;
|
|
11609
11539
|
exports.OmerEvent = OmerEvent;
|
|
11610
11540
|
exports.ParshaEvent = ParshaEvent;
|
|
11611
11541
|
exports.RoshChodeshEvent = RoshChodeshEvent;
|
|
@@ -11622,4 +11552,4 @@ exports.version = version;
|
|
|
11622
11552
|
|
|
11623
11553
|
return exports;
|
|
11624
11554
|
|
|
11625
|
-
})({});
|
|
11555
|
+
})({}, Temporal);
|