@hebcal/core 4.4.0 → 4.5.0
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/README.md +59 -41
- package/dist/bundle.js +150 -106
- package/dist/bundle.min.js +2 -2
- package/dist/greg0.mjs +1 -1
- package/dist/hdate-bundle.js +11 -12
- package/dist/hdate-bundle.min.js +2 -2
- package/dist/hdate.js +11 -12
- package/dist/hdate.mjs +11 -10
- package/dist/hdate0-bundle.js +1 -1
- package/dist/hdate0-bundle.min.js +1 -1
- package/dist/hdate0.mjs +1 -1
- package/dist/index.js +148 -104
- package/dist/index.mjs +148 -104
- package/hebcal.d.ts +29 -8
- package/package.json +11 -12
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v4.
|
|
1
|
+
/*! @hebcal/core v4.5.0 */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
/*
|
|
@@ -325,8 +325,8 @@ function gematriya(number) {
|
|
|
325
325
|
const thousands = Math.floor(num / 1000);
|
|
326
326
|
if (thousands > 0 && thousands !== 5) {
|
|
327
327
|
const tdigits = num2digits(thousands);
|
|
328
|
-
for (
|
|
329
|
-
str += num2heb[
|
|
328
|
+
for (const tdig of tdigits) {
|
|
329
|
+
str += num2heb[tdig];
|
|
330
330
|
}
|
|
331
331
|
str += GERESH;
|
|
332
332
|
}
|
|
@@ -361,8 +361,8 @@ function gematriyaStrToNum(str) {
|
|
|
361
361
|
num += gematriyaStrToNum(thousands) * 1000;
|
|
362
362
|
str = str.substring(gereshIdx);
|
|
363
363
|
}
|
|
364
|
-
for (
|
|
365
|
-
const n = heb2num[
|
|
364
|
+
for (const ch of str) {
|
|
365
|
+
const n = heb2num[ch];
|
|
366
366
|
if (typeof n === 'number') {
|
|
367
367
|
num += n;
|
|
368
368
|
}
|
|
@@ -409,7 +409,7 @@ class Locale {
|
|
|
409
409
|
* @return {string}
|
|
410
410
|
*/
|
|
411
411
|
static lookupTranslation(id, locale) {
|
|
412
|
-
const locale0 = locale
|
|
412
|
+
const locale0 = locale === null || locale === void 0 ? void 0 : locale.toLowerCase();
|
|
413
413
|
const loc = typeof locale == 'string' && locales[locale0] || activeLocale;
|
|
414
414
|
const array = loc[id];
|
|
415
415
|
if (array && array.length && array[0].length) {
|
|
@@ -529,7 +529,7 @@ class Locale {
|
|
|
529
529
|
* @return {string[]}
|
|
530
530
|
*/
|
|
531
531
|
static getLocaleNames() {
|
|
532
|
-
return Object.keys(locales).sort();
|
|
532
|
+
return Object.keys(locales).sort((a, b) => a.localeCompare(b));
|
|
533
533
|
}
|
|
534
534
|
|
|
535
535
|
/**
|
|
@@ -538,7 +538,7 @@ class Locale {
|
|
|
538
538
|
* @return {string}
|
|
539
539
|
*/
|
|
540
540
|
static ordinal(n, locale) {
|
|
541
|
-
const locale1 = locale
|
|
541
|
+
const locale1 = locale === null || locale === void 0 ? void 0 : locale.toLowerCase();
|
|
542
542
|
const locale0 = locale1 || activeName;
|
|
543
543
|
if (!locale0) {
|
|
544
544
|
return this.getEnOrdinal(n);
|
|
@@ -1203,7 +1203,7 @@ class HDate {
|
|
|
1203
1203
|
if (ofStr) {
|
|
1204
1204
|
return ' ' + ofStr;
|
|
1205
1205
|
}
|
|
1206
|
-
if ('ashkenazi'
|
|
1206
|
+
if (locale.startsWith('ashkenazi')) {
|
|
1207
1207
|
return ' of';
|
|
1208
1208
|
}
|
|
1209
1209
|
return '';
|
|
@@ -1573,6 +1573,7 @@ class HDate {
|
|
|
1573
1573
|
case 'h':
|
|
1574
1574
|
return months.SHVAT;
|
|
1575
1575
|
}
|
|
1576
|
+
break;
|
|
1576
1577
|
case 't':
|
|
1577
1578
|
switch (c[1]) {
|
|
1578
1579
|
case 'a':
|
|
@@ -1592,9 +1593,7 @@ class HDate {
|
|
|
1592
1593
|
return months.ADAR_I;
|
|
1593
1594
|
}
|
|
1594
1595
|
return months.ADAR_II;
|
|
1595
|
-
// else assume sheini
|
|
1596
1596
|
}
|
|
1597
|
-
|
|
1598
1597
|
break;
|
|
1599
1598
|
case 'ס':
|
|
1600
1599
|
return months.SIVAN;
|
|
@@ -1953,8 +1952,7 @@ class Event {
|
|
|
1953
1952
|
*/
|
|
1954
1953
|
getCategories() {
|
|
1955
1954
|
const mask = this.getFlags();
|
|
1956
|
-
for (
|
|
1957
|
-
const attrs = flagToCategory[i];
|
|
1955
|
+
for (const attrs of flagToCategory) {
|
|
1958
1956
|
if (mask & attrs[0]) {
|
|
1959
1957
|
return attrs.slice(1);
|
|
1960
1958
|
}
|
|
@@ -1983,7 +1981,7 @@ class HebrewDateEvent extends Event {
|
|
|
1983
1981
|
* @return {string}
|
|
1984
1982
|
*/
|
|
1985
1983
|
render(locale) {
|
|
1986
|
-
const locale1 = locale
|
|
1984
|
+
const locale1 = locale === null || locale === void 0 ? void 0 : locale.toLowerCase();
|
|
1987
1985
|
const locale0 = locale1 || Locale.getLocaleName();
|
|
1988
1986
|
const hd = this.getDate();
|
|
1989
1987
|
switch (locale0) {
|
|
@@ -2010,7 +2008,7 @@ class HebrewDateEvent extends Event {
|
|
|
2010
2008
|
* @return {string}
|
|
2011
2009
|
*/
|
|
2012
2010
|
renderBrief(locale) {
|
|
2013
|
-
const locale1 = locale
|
|
2011
|
+
const locale1 = locale === null || locale === void 0 ? void 0 : locale.toLowerCase();
|
|
2014
2012
|
const locale0 = locale1 || Locale.getLocaleName();
|
|
2015
2013
|
const hd = this.getDate();
|
|
2016
2014
|
if (hd.getMonth() === months.TISHREI && hd.getDate() === 1) {
|
|
@@ -2438,7 +2436,30 @@ function pad2(number) {
|
|
|
2438
2436
|
* @property {Date} tzeit
|
|
2439
2437
|
*/
|
|
2440
2438
|
|
|
2441
|
-
/**
|
|
2439
|
+
/**
|
|
2440
|
+
* Calculate halachic times (zmanim / זְמַנִּים) for a given day and location.
|
|
2441
|
+
* Calculations are available for tzeit / tzais (nightfall),
|
|
2442
|
+
* shkiah (sunset) and more.
|
|
2443
|
+
*
|
|
2444
|
+
* Zmanim are estimated using an algorithm published by the US National Oceanic
|
|
2445
|
+
* and Atmospheric Administration. The NOAA solar calculator is based on equations
|
|
2446
|
+
* from _Astronomical Algorithms_ by Jean Meeus.
|
|
2447
|
+
*
|
|
2448
|
+
* The sunrise and sunset results are theoretically accurate to within a minute for
|
|
2449
|
+
* locations between +/- 72° latitude, and within 10 minutes outside of those latitudes.
|
|
2450
|
+
* However, due to variations in atmospheric composition, temperature, pressure and
|
|
2451
|
+
* conditions, observed values may vary from calculations.
|
|
2452
|
+
* https://gml.noaa.gov/grad/solcalc/calcdetails.html
|
|
2453
|
+
*
|
|
2454
|
+
* @example
|
|
2455
|
+
* const {Zmanim} = require('@hebcal/core');
|
|
2456
|
+
* const latitude = 41.822232;
|
|
2457
|
+
* const longitude = -71.448292;
|
|
2458
|
+
* const friday = new Date(2023, 8, 8);
|
|
2459
|
+
* const zmanim = new Zmanim(friday, latitude, longitude);
|
|
2460
|
+
* const candleLighting = zmanim.sunsetOffset(-18, true);
|
|
2461
|
+
* const timeStr = Zmanim.formatISOWithTimeZone('America/New_York', candleLighting);
|
|
2462
|
+
*/
|
|
2442
2463
|
class Zmanim {
|
|
2443
2464
|
/**
|
|
2444
2465
|
* Initialize a Zmanim instance.
|
|
@@ -2488,6 +2509,16 @@ class Zmanim {
|
|
|
2488
2509
|
tzeit: this.tzeit()
|
|
2489
2510
|
};
|
|
2490
2511
|
}
|
|
2512
|
+
/**
|
|
2513
|
+
* Convenience function to get the time when sun is above or below the horizon
|
|
2514
|
+
* for a certain angle (in degrees).
|
|
2515
|
+
* @param {number} angle
|
|
2516
|
+
* @param {boolean} rising
|
|
2517
|
+
* @return {Date}
|
|
2518
|
+
*/
|
|
2519
|
+
timeAtAngle(angle, rising) {
|
|
2520
|
+
return this.sun.timeAtAngle(angle, rising);
|
|
2521
|
+
}
|
|
2491
2522
|
/**
|
|
2492
2523
|
* Upper edge of the Sun appears over the eastern horizon in the morning (0.833° above horizon)
|
|
2493
2524
|
* @return {Date}
|
|
@@ -2644,7 +2675,7 @@ class Zmanim {
|
|
|
2644
2675
|
}
|
|
2645
2676
|
/**
|
|
2646
2677
|
* @param {number} [angle=8.5] optional time for solar depression.
|
|
2647
|
-
* Default is 8.5 degrees for 3 small stars, use 7.083
|
|
2678
|
+
* Default is 8.5 degrees for 3 small stars, use 7.083 degrees for 3 medium-sized stars.
|
|
2648
2679
|
* @return {Date}
|
|
2649
2680
|
*/
|
|
2650
2681
|
tzeit(angle = 8.5) {
|
|
@@ -2791,7 +2822,7 @@ class Zmanim {
|
|
|
2791
2822
|
* Returns an array with tzeit Date object and a 24-hour string formatted time.
|
|
2792
2823
|
* @deprecated
|
|
2793
2824
|
* @param {number} angle degrees for solar depression.
|
|
2794
|
-
* Default is 8.5 degrees for 3 small stars, use 7.083
|
|
2825
|
+
* Default is 8.5 degrees for 3 small stars, use 7.083 degrees for 3 medium-sized stars.
|
|
2795
2826
|
* @param {Intl.DateTimeFormat} timeFormat
|
|
2796
2827
|
* @return {Object[]}
|
|
2797
2828
|
*/
|
|
@@ -3124,17 +3155,6 @@ const days = {
|
|
|
3124
3155
|
SAT: 6
|
|
3125
3156
|
};
|
|
3126
3157
|
|
|
3127
|
-
/**
|
|
3128
|
-
* @private
|
|
3129
|
-
* @constant
|
|
3130
|
-
* This method returns the tzais (nightfall) based on the opinion of the
|
|
3131
|
-
* Geonim calculated as 30 minutes after sunset during the equinox
|
|
3132
|
-
* (on March 16, about 4 days before the astronomical equinox, the day that
|
|
3133
|
-
* a solar hour is 60 minutes) in Yerushalayim.
|
|
3134
|
-
* @see {https://kosherjava.com/zmanim/docs/api/com/kosherjava/zmanim/ComplexZmanimCalendar.html#getTzaisGeonim7Point083Degrees()}
|
|
3135
|
-
*/
|
|
3136
|
-
const TZEIT_3MEDIUM_STARS = 7.083;
|
|
3137
|
-
|
|
3138
3158
|
/**
|
|
3139
3159
|
* @private
|
|
3140
3160
|
* @param {Event} e
|
|
@@ -3294,10 +3314,10 @@ class CandleLightingEvent extends TimedEvent {
|
|
|
3294
3314
|
* Makes a pair of events representing fast start and end times
|
|
3295
3315
|
* @private
|
|
3296
3316
|
* @param {Event} ev
|
|
3297
|
-
* @param {
|
|
3317
|
+
* @param {CalOptions} options
|
|
3298
3318
|
* @return {Event}
|
|
3299
3319
|
*/
|
|
3300
|
-
function makeFastStartEnd(ev,
|
|
3320
|
+
function makeFastStartEnd(ev, options) {
|
|
3301
3321
|
const desc = ev.getDesc();
|
|
3302
3322
|
if (desc === 'Yom Kippur') {
|
|
3303
3323
|
return ev;
|
|
@@ -3305,17 +3325,19 @@ function makeFastStartEnd(ev, location) {
|
|
|
3305
3325
|
ev = ev.clone();
|
|
3306
3326
|
const hd = ev.getDate();
|
|
3307
3327
|
const dt = hd.greg();
|
|
3328
|
+
const location = options.location;
|
|
3329
|
+
const fastEndDeg = options.fastEndDeg;
|
|
3308
3330
|
const zmanim = new Zmanim(dt, location.getLatitude(), location.getLongitude());
|
|
3309
3331
|
if (desc === 'Erev Tish\'a B\'Av') {
|
|
3310
3332
|
const sunset = zmanim.sunset();
|
|
3311
3333
|
ev.startEvent = makeTimedEvent(hd, sunset, 'Fast begins', ev, location);
|
|
3312
|
-
} else if (desc.
|
|
3313
|
-
ev.endEvent = makeTimedEvent(hd, zmanim.tzeit(
|
|
3334
|
+
} else if (desc.startsWith('Tish\'a B\'Av')) {
|
|
3335
|
+
ev.endEvent = makeTimedEvent(hd, zmanim.tzeit(fastEndDeg), 'Fast ends', ev, location);
|
|
3314
3336
|
} else {
|
|
3315
3337
|
const dawn = zmanim.alotHaShachar();
|
|
3316
3338
|
ev.startEvent = makeTimedEvent(hd, dawn, 'Fast begins', ev, location);
|
|
3317
3339
|
if (dt.getDay() !== 5 && !(hd.getDate() === 14 && hd.getMonth() === months.NISAN)) {
|
|
3318
|
-
ev.endEvent = makeTimedEvent(hd, zmanim.tzeit(
|
|
3340
|
+
ev.endEvent = makeTimedEvent(hd, zmanim.tzeit(fastEndDeg), 'Fast ends', ev, location);
|
|
3319
3341
|
}
|
|
3320
3342
|
}
|
|
3321
3343
|
return ev;
|
|
@@ -4614,16 +4636,6 @@ const staticModernHolidays = [{
|
|
|
4614
4636
|
|
|
4615
4637
|
/** Represents a built-in holiday like Pesach, Purim or Tu BiShvat */
|
|
4616
4638
|
class HolidayEvent extends Event {
|
|
4617
|
-
/**
|
|
4618
|
-
* Constructs Holiday event
|
|
4619
|
-
* @param {HDate} date Hebrew date event occurs
|
|
4620
|
-
* @param {string} desc Description (not translated)
|
|
4621
|
-
* @param {number} [mask=0] optional holiday flags
|
|
4622
|
-
* @param {Object} [attrs={}]
|
|
4623
|
-
*/
|
|
4624
|
-
constructor(date, desc, mask, attrs) {
|
|
4625
|
-
super(date, desc, mask, attrs);
|
|
4626
|
-
}
|
|
4627
4639
|
/** @return {string} */
|
|
4628
4640
|
basename() {
|
|
4629
4641
|
return this.getDesc().replace(/ \d{4}$/, '').replace(/ \(CH''M\)$/, '').replace(/ \(observed\)$/, '').replace(/ \(Hoshana Raba\)$/, '').replace(/ [IV]+$/, '').replace(/: \d Candles?$/, '').replace(/: 8th Day$/, '').replace(/^Erev /, '');
|
|
@@ -4715,15 +4727,6 @@ class RoshChodeshEvent extends HolidayEvent {
|
|
|
4715
4727
|
* we subclass HolidayEvent to override the `url()` method.
|
|
4716
4728
|
*/
|
|
4717
4729
|
class AsaraBTevetEvent extends HolidayEvent {
|
|
4718
|
-
/**
|
|
4719
|
-
* Constructs AsaraBTevetEvent
|
|
4720
|
-
* @param {HDate} date Hebrew date event occurs
|
|
4721
|
-
* @param {string} desc Description (not translated)
|
|
4722
|
-
* @param {number} [mask=0] optional holiday flags
|
|
4723
|
-
*/
|
|
4724
|
-
constructor(date, desc, mask) {
|
|
4725
|
-
super(date, desc, mask);
|
|
4726
|
-
}
|
|
4727
4730
|
/** @return {string} */
|
|
4728
4731
|
urlDateSuffix() {
|
|
4729
4732
|
const isoDateTime = this.getDate().greg().toISOString();
|
|
@@ -5259,7 +5262,7 @@ function getBirthdayOrAnniversary_(hyear, gdate) {
|
|
|
5259
5262
|
return new HDate(day, month, hyear);
|
|
5260
5263
|
}
|
|
5261
5264
|
|
|
5262
|
-
const version="4.
|
|
5265
|
+
const version="4.5.0";
|
|
5263
5266
|
|
|
5264
5267
|
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};
|
|
5265
5268
|
|
|
@@ -5454,9 +5457,9 @@ function tachanunYear(year, il) {
|
|
|
5454
5457
|
);
|
|
5455
5458
|
|
|
5456
5459
|
return {
|
|
5457
|
-
none: none.map(hd => hd.abs()).sort(),
|
|
5458
|
-
some: some.map(hd => hd.abs()).sort(),
|
|
5459
|
-
yesPrev: yesPrev.map(hd => hd.abs()).sort()
|
|
5460
|
+
none: none.map(hd => hd.abs()).sort((a, b) => a - b),
|
|
5461
|
+
some: some.map(hd => hd.abs()).sort((a, b) => a - b),
|
|
5462
|
+
yesPrev: yesPrev.map(hd => hd.abs()).sort((a, b) => a - b)
|
|
5460
5463
|
};
|
|
5461
5464
|
}
|
|
5462
5465
|
|
|
@@ -5502,11 +5505,15 @@ const MAJOR_FAST = flags.MAJOR_FAST;
|
|
|
5502
5505
|
const ROSH_CHODESH = flags.ROSH_CHODESH;
|
|
5503
5506
|
const PARSHA_HASHAVUA = flags.PARSHA_HASHAVUA;
|
|
5504
5507
|
const DAF_YOMI = flags.DAF_YOMI;
|
|
5508
|
+
const MISHNA_YOMI = flags.MISHNA_YOMI;
|
|
5509
|
+
const NACH_YOMI = flags.NACH_YOMI;
|
|
5510
|
+
const YERUSHALMI_YOMI = flags.YERUSHALMI_YOMI;
|
|
5505
5511
|
const OMER_COUNT = flags.OMER_COUNT;
|
|
5506
5512
|
const SHABBAT_MEVARCHIM = flags.SHABBAT_MEVARCHIM;
|
|
5507
5513
|
const MINOR_HOLIDAY = flags.MINOR_HOLIDAY;
|
|
5508
5514
|
const EREV = flags.EREV;
|
|
5509
5515
|
const CHOL_HAMOED = flags.CHOL_HAMOED;
|
|
5516
|
+
const YOM_KIPPUR_KATAN = flags.YOM_KIPPUR_KATAN;
|
|
5510
5517
|
const unrecognizedAlreadyWarned = Object.create(null);
|
|
5511
5518
|
const RECOGNIZED_OPTIONS = {
|
|
5512
5519
|
location: 1,
|
|
@@ -5520,6 +5527,7 @@ const RECOGNIZED_OPTIONS = {
|
|
|
5520
5527
|
candleLightingMins: 1,
|
|
5521
5528
|
havdalahMins: 1,
|
|
5522
5529
|
havdalahDeg: 1,
|
|
5530
|
+
fastEndDeg: 1,
|
|
5523
5531
|
sedrot: 1,
|
|
5524
5532
|
il: 1,
|
|
5525
5533
|
noMinorFast: 1,
|
|
@@ -5583,6 +5591,27 @@ const geoIdCandleOffset = {
|
|
|
5583
5591
|
'293067': 30 // Zikhron Yaakov
|
|
5584
5592
|
};
|
|
5585
5593
|
|
|
5594
|
+
/**
|
|
5595
|
+
* @private
|
|
5596
|
+
* @constant
|
|
5597
|
+
* This calculation is based on the position of the sun 36 minutes after sunset in Jerusalem
|
|
5598
|
+
* around the equinox / equilux, which is 8.5° below geometric zenith.
|
|
5599
|
+
* The Ohr Meir considers this the time that 3 small stars are visible,
|
|
5600
|
+
* which is later than the required 3 medium stars.
|
|
5601
|
+
* @see {https://kosherjava.com/zmanim/docs/api/com/kosherjava/zmanim/ZmanimCalendar.html#ZENITH_8_POINT_5}
|
|
5602
|
+
*/
|
|
5603
|
+
const TZEIT_3SMALL_STARS = 8.5;
|
|
5604
|
+
|
|
5605
|
+
/**
|
|
5606
|
+
* @private
|
|
5607
|
+
* @constant
|
|
5608
|
+
* This calculation is based on observation of 3 medium sized stars by Dr. Baruch Cohen
|
|
5609
|
+
* in his calendar published in in 1899 in Strasbourg, France.
|
|
5610
|
+
* This calculates to 7.0833333° below geometric zenith.
|
|
5611
|
+
* @see {https://kosherjava.com/zmanim/docs/api/com/kosherjava/zmanim/ComplexZmanimCalendar.html#ZENITH_7_POINT_083}
|
|
5612
|
+
*/
|
|
5613
|
+
const TZEIT_3MEDIUM_STARS = 7.0833333;
|
|
5614
|
+
|
|
5586
5615
|
/**
|
|
5587
5616
|
* Modifies options in-place
|
|
5588
5617
|
* @private
|
|
@@ -5593,7 +5622,7 @@ function checkCandleOptions(options) {
|
|
|
5593
5622
|
return;
|
|
5594
5623
|
}
|
|
5595
5624
|
const location = options.location;
|
|
5596
|
-
if (typeof location === 'undefined' || !location instanceof Location) {
|
|
5625
|
+
if (typeof location === 'undefined' || !(location instanceof Location)) {
|
|
5597
5626
|
throw new TypeError('options.candlelighting requires valid options.location');
|
|
5598
5627
|
}
|
|
5599
5628
|
if (typeof options.havdalahMins === 'number' && typeof options.havdalahDeg === 'number') {
|
|
@@ -5617,7 +5646,10 @@ function checkCandleOptions(options) {
|
|
|
5617
5646
|
} else if (typeof options.havdalahDeg === 'number') {
|
|
5618
5647
|
options.havdalahDeg = Math.abs(options.havdalahDeg);
|
|
5619
5648
|
} else {
|
|
5620
|
-
options.havdalahDeg =
|
|
5649
|
+
options.havdalahDeg = TZEIT_3SMALL_STARS;
|
|
5650
|
+
}
|
|
5651
|
+
if (typeof options.fastEndDeg !== 'number') {
|
|
5652
|
+
options.fastEndDeg = TZEIT_3MEDIUM_STARS;
|
|
5621
5653
|
}
|
|
5622
5654
|
}
|
|
5623
5655
|
|
|
@@ -5636,10 +5668,14 @@ function checkCandleOptions(options) {
|
|
|
5636
5668
|
* @property {number} havdalahMins - minutes after sundown for Havdalah (typical values are 42, 50, or 72).
|
|
5637
5669
|
* If `undefined` (the default), calculate Havdalah according to Tzeit Hakochavim -
|
|
5638
5670
|
* Nightfall (the point when 3 small stars are observable in the night time sky with
|
|
5639
|
-
* the naked eye). If `0`, Havdalah times are
|
|
5671
|
+
* the naked eye). If `0`, Havdalah times are suppressed.
|
|
5640
5672
|
* @property {number} havdalahDeg - degrees for solar depression for Havdalah.
|
|
5641
|
-
* Default is 8.5 degrees for 3 small stars. use 7.083
|
|
5642
|
-
*
|
|
5673
|
+
* Default is 8.5 degrees for 3 small stars. use 7.083 degrees for 3 medium-sized stars
|
|
5674
|
+
* (observed by Dr. Baruch (Berthold) Cohn in his luach published in France in 1899).
|
|
5675
|
+
* If `0`, Havdalah times are suppressed.
|
|
5676
|
+
* @property {number} fastEndDeg - degrees for solar depression for end of fast days.
|
|
5677
|
+
* Default is 7.083 degrees for 3 medium-sized stars. Other commonly-used values include
|
|
5678
|
+
* 6.45 degrees, as calculated by Rabbi Yechiel Michel Tucazinsky.
|
|
5643
5679
|
* @property {boolean} sedrot - calculate parashah hashavua on Saturdays
|
|
5644
5680
|
* @property {boolean} il - Israeli holiday and sedra schedule
|
|
5645
5681
|
* @property {boolean} noMinorFast - suppress minor fasts
|
|
@@ -5760,36 +5796,11 @@ function getStartAndEnd(options) {
|
|
|
5760
5796
|
* @return {number}
|
|
5761
5797
|
*/
|
|
5762
5798
|
function getMaskFromOptions(options) {
|
|
5799
|
+
var _options$location;
|
|
5763
5800
|
if (typeof options.mask === 'number') {
|
|
5764
|
-
|
|
5765
|
-
if (m & ROSH_CHODESH) delete options.noRoshChodesh;
|
|
5766
|
-
if (m & MODERN_HOLIDAY) delete options.noModern;
|
|
5767
|
-
if (m & MINOR_FAST) delete options.noMinorFast;
|
|
5768
|
-
if (m & SPECIAL_SHABBAT) delete options.noSpecialShabbat;
|
|
5769
|
-
if (m & PARSHA_HASHAVUA) options.sedrot = true;
|
|
5770
|
-
if (m & DAF_YOMI) {
|
|
5771
|
-
options.dailyLearning = options.dailyLearning || {};
|
|
5772
|
-
options.dailyLearning.dafYomi = true;
|
|
5773
|
-
}
|
|
5774
|
-
if (m & OMER_COUNT) options.omer = true;
|
|
5775
|
-
if (m & SHABBAT_MEVARCHIM) options.shabbatMevarchim = true;
|
|
5776
|
-
if (m & flags.MISHNA_YOMI) {
|
|
5777
|
-
options.dailyLearning = options.dailyLearning || {};
|
|
5778
|
-
options.dailyLearning.mishnaYomi = true;
|
|
5779
|
-
}
|
|
5780
|
-
if (m & flags.NACH_YOMI) {
|
|
5781
|
-
options.dailyLearning = options.dailyLearning || {};
|
|
5782
|
-
options.dailyLearning.nachYomi = true;
|
|
5783
|
-
}
|
|
5784
|
-
if (m & flags.YOM_KIPPUR_KATAN) options.yomKippurKatan = true;
|
|
5785
|
-
if (m & flags.YERUSHALMI_YOMI) {
|
|
5786
|
-
options.dailyLearning = options.dailyLearning || {};
|
|
5787
|
-
options.dailyLearning.yerushalmi = 1;
|
|
5788
|
-
}
|
|
5789
|
-
options.userMask = true;
|
|
5790
|
-
return m;
|
|
5801
|
+
return setOptionsFromMask(options);
|
|
5791
5802
|
}
|
|
5792
|
-
const il = options.il ||
|
|
5803
|
+
const il = options.il || ((_options$location = options.location) === null || _options$location === void 0 ? void 0 : _options$location.il) || false;
|
|
5793
5804
|
let mask = 0;
|
|
5794
5805
|
|
|
5795
5806
|
// default options
|
|
@@ -5829,7 +5840,7 @@ function getMaskFromOptions(options) {
|
|
|
5829
5840
|
mask |= SHABBAT_MEVARCHIM;
|
|
5830
5841
|
}
|
|
5831
5842
|
if (options.yomKippurKatan) {
|
|
5832
|
-
mask |=
|
|
5843
|
+
mask |= YOM_KIPPUR_KATAN;
|
|
5833
5844
|
}
|
|
5834
5845
|
if (options.dailyLearning) {
|
|
5835
5846
|
const dailyLearning = options.dailyLearning;
|
|
@@ -5837,13 +5848,13 @@ function getMaskFromOptions(options) {
|
|
|
5837
5848
|
mask |= DAF_YOMI;
|
|
5838
5849
|
}
|
|
5839
5850
|
if (dailyLearning.mishnaYomi) {
|
|
5840
|
-
mask |=
|
|
5851
|
+
mask |= MISHNA_YOMI;
|
|
5841
5852
|
}
|
|
5842
5853
|
if (dailyLearning.nachYomi) {
|
|
5843
|
-
mask |=
|
|
5854
|
+
mask |= NACH_YOMI;
|
|
5844
5855
|
}
|
|
5845
5856
|
if (dailyLearning.yerushalmi) {
|
|
5846
|
-
mask |=
|
|
5857
|
+
mask |= YERUSHALMI_YOMI;
|
|
5847
5858
|
}
|
|
5848
5859
|
}
|
|
5849
5860
|
return mask;
|
|
@@ -5865,6 +5876,40 @@ const hour12cc = {
|
|
|
5865
5876
|
ZA: 1
|
|
5866
5877
|
};
|
|
5867
5878
|
|
|
5879
|
+
/**
|
|
5880
|
+
* @private
|
|
5881
|
+
* @param {CalOptions} options
|
|
5882
|
+
* @return {number}
|
|
5883
|
+
*/
|
|
5884
|
+
function setOptionsFromMask(options) {
|
|
5885
|
+
const m = options.mask;
|
|
5886
|
+
if (m & ROSH_CHODESH) delete options.noRoshChodesh;
|
|
5887
|
+
if (m & MODERN_HOLIDAY) delete options.noModern;
|
|
5888
|
+
if (m & MINOR_FAST) delete options.noMinorFast;
|
|
5889
|
+
if (m & SPECIAL_SHABBAT) delete options.noSpecialShabbat;
|
|
5890
|
+
if (m & PARSHA_HASHAVUA) options.sedrot = true;
|
|
5891
|
+
if (m & (DAF_YOMI | MISHNA_YOMI | NACH_YOMI | YERUSHALMI_YOMI)) {
|
|
5892
|
+
options.dailyLearning = options.dailyLearning || {};
|
|
5893
|
+
if (m & DAF_YOMI) {
|
|
5894
|
+
options.dailyLearning.dafYomi = true;
|
|
5895
|
+
}
|
|
5896
|
+
if (m & MISHNA_YOMI) {
|
|
5897
|
+
options.dailyLearning.mishnaYomi = true;
|
|
5898
|
+
}
|
|
5899
|
+
if (m & NACH_YOMI) {
|
|
5900
|
+
options.dailyLearning.nachYomi = true;
|
|
5901
|
+
}
|
|
5902
|
+
if (m & YERUSHALMI_YOMI) {
|
|
5903
|
+
options.dailyLearning.yerushalmi = 1;
|
|
5904
|
+
}
|
|
5905
|
+
}
|
|
5906
|
+
if (m & OMER_COUNT) options.omer = true;
|
|
5907
|
+
if (m & SHABBAT_MEVARCHIM) options.shabbatMevarchim = true;
|
|
5908
|
+
if (m & YOM_KIPPUR_KATAN) options.yomKippurKatan = true;
|
|
5909
|
+
options.userMask = true;
|
|
5910
|
+
return m;
|
|
5911
|
+
}
|
|
5912
|
+
|
|
5868
5913
|
/**
|
|
5869
5914
|
* @private
|
|
5870
5915
|
* @param {Event} ev
|
|
@@ -5951,10 +5996,10 @@ class HebrewCalendar {
|
|
|
5951
5996
|
* These defaults can be changed using these options:
|
|
5952
5997
|
* * `options.candleLightingMins` - minutes before sundown to light candles
|
|
5953
5998
|
* * `options.havdalahMins` - minutes after sundown for Havdalah (typical values are 42, 50, or 72).
|
|
5954
|
-
* Havdalah times are
|
|
5999
|
+
* Havdalah times are suppressed when `options.havdalahMins=0`.
|
|
5955
6000
|
* * `options.havdalahDeg` - degrees for solar depression for Havdalah.
|
|
5956
|
-
* Default is 8.5 degrees for 3 small stars. Use 7.083
|
|
5957
|
-
* Havdalah times are
|
|
6001
|
+
* Default is 8.5 degrees for 3 small stars. Use 7.083 degrees for 3 medium-sized stars.
|
|
6002
|
+
* Havdalah times are suppressed when `options.havdalahDeg=0`.
|
|
5958
6003
|
*
|
|
5959
6004
|
* If both `options.candlelighting=true` and `options.location` is specified,
|
|
5960
6005
|
* Chanukah candle-lighting times and minor fast start/end times will also be generated.
|
|
@@ -6047,7 +6092,7 @@ class HebrewCalendar {
|
|
|
6047
6092
|
}
|
|
6048
6093
|
const prevEventsLength = evts.length;
|
|
6049
6094
|
const dow = hd.getDay();
|
|
6050
|
-
let candlesEv
|
|
6095
|
+
let candlesEv;
|
|
6051
6096
|
const ev = holidaysYear.get(hd.toString()) || [];
|
|
6052
6097
|
ev.forEach(e => {
|
|
6053
6098
|
candlesEv = appendHolidayAndRelated(evts, e, options, candlesEv, dow);
|
|
@@ -6251,8 +6296,9 @@ class HebrewCalendar {
|
|
|
6251
6296
|
* @return {string}
|
|
6252
6297
|
*/
|
|
6253
6298
|
static reformatTimeStr(timeStr, suffix, options) {
|
|
6299
|
+
var _options$location2;
|
|
6254
6300
|
if (typeof timeStr !== 'string') throw new TypeError(`Bad timeStr: ${timeStr}`);
|
|
6255
|
-
const cc = options.location
|
|
6301
|
+
const cc = ((_options$location2 = options.location) === null || _options$location2 === void 0 ? void 0 : _options$location2.cc) || (options.il ? 'IL' : 'US');
|
|
6256
6302
|
if (typeof options.hour12 !== 'undefined' && !options.hour12) {
|
|
6257
6303
|
return timeStr;
|
|
6258
6304
|
}
|
|
@@ -6356,7 +6402,7 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
|
|
|
6356
6402
|
}
|
|
6357
6403
|
|
|
6358
6404
|
const eFlags = ev.getFlags();
|
|
6359
|
-
if (!options.yomKippurKatan && eFlags &
|
|
6405
|
+
if (!options.yomKippurKatan && eFlags & YOM_KIPPUR_KATAN || options.noModern && eFlags & MODERN_HOLIDAY) {
|
|
6360
6406
|
return candlesEv; // bail out early
|
|
6361
6407
|
}
|
|
6362
6408
|
|
|
@@ -6364,7 +6410,7 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
|
|
|
6364
6410
|
const isMajorFast = Boolean(eFlags & MAJOR_FAST);
|
|
6365
6411
|
const isMinorFast = Boolean(eFlags & MINOR_FAST);
|
|
6366
6412
|
if (options.candlelighting && (isMajorFast || isMinorFast)) {
|
|
6367
|
-
ev = makeFastStartEnd(ev,
|
|
6413
|
+
ev = makeFastStartEnd(ev, options);
|
|
6368
6414
|
if (ev.startEvent && (isMajorFast || isMinorFast && !options.noMinorFast)) {
|
|
6369
6415
|
events.push(ev.startEvent);
|
|
6370
6416
|
}
|
|
@@ -6388,9 +6434,7 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
|
|
|
6388
6434
|
candlesEv = undefined;
|
|
6389
6435
|
}
|
|
6390
6436
|
}
|
|
6391
|
-
if (options.yomKippurKatan && eFlags &
|
|
6392
|
-
events.push(ev);
|
|
6393
|
-
} else if (!options.noHolidays) {
|
|
6437
|
+
if (!options.noHolidays || options.yomKippurKatan && eFlags & YOM_KIPPUR_KATAN) {
|
|
6394
6438
|
events.push(ev); // the original event itself
|
|
6395
6439
|
}
|
|
6396
6440
|
}
|