@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.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v4.
|
|
1
|
+
/*! @hebcal/core v4.5.0 */
|
|
2
2
|
/*
|
|
3
3
|
* More minimal greg routines
|
|
4
4
|
*/
|
|
@@ -323,8 +323,8 @@ function gematriya(number) {
|
|
|
323
323
|
const thousands = Math.floor(num / 1000);
|
|
324
324
|
if (thousands > 0 && thousands !== 5) {
|
|
325
325
|
const tdigits = num2digits(thousands);
|
|
326
|
-
for (
|
|
327
|
-
str += num2heb[
|
|
326
|
+
for (const tdig of tdigits) {
|
|
327
|
+
str += num2heb[tdig];
|
|
328
328
|
}
|
|
329
329
|
str += GERESH;
|
|
330
330
|
}
|
|
@@ -359,8 +359,8 @@ function gematriyaStrToNum(str) {
|
|
|
359
359
|
num += gematriyaStrToNum(thousands) * 1000;
|
|
360
360
|
str = str.substring(gereshIdx);
|
|
361
361
|
}
|
|
362
|
-
for (
|
|
363
|
-
const n = heb2num[
|
|
362
|
+
for (const ch of str) {
|
|
363
|
+
const n = heb2num[ch];
|
|
364
364
|
if (typeof n === 'number') {
|
|
365
365
|
num += n;
|
|
366
366
|
}
|
|
@@ -407,7 +407,7 @@ class Locale {
|
|
|
407
407
|
* @return {string}
|
|
408
408
|
*/
|
|
409
409
|
static lookupTranslation(id, locale) {
|
|
410
|
-
const locale0 = locale
|
|
410
|
+
const locale0 = locale === null || locale === void 0 ? void 0 : locale.toLowerCase();
|
|
411
411
|
const loc = typeof locale == 'string' && locales[locale0] || activeLocale;
|
|
412
412
|
const array = loc[id];
|
|
413
413
|
if (array && array.length && array[0].length) {
|
|
@@ -527,7 +527,7 @@ class Locale {
|
|
|
527
527
|
* @return {string[]}
|
|
528
528
|
*/
|
|
529
529
|
static getLocaleNames() {
|
|
530
|
-
return Object.keys(locales).sort();
|
|
530
|
+
return Object.keys(locales).sort((a, b) => a.localeCompare(b));
|
|
531
531
|
}
|
|
532
532
|
|
|
533
533
|
/**
|
|
@@ -536,7 +536,7 @@ class Locale {
|
|
|
536
536
|
* @return {string}
|
|
537
537
|
*/
|
|
538
538
|
static ordinal(n, locale) {
|
|
539
|
-
const locale1 = locale
|
|
539
|
+
const locale1 = locale === null || locale === void 0 ? void 0 : locale.toLowerCase();
|
|
540
540
|
const locale0 = locale1 || activeName;
|
|
541
541
|
if (!locale0) {
|
|
542
542
|
return this.getEnOrdinal(n);
|
|
@@ -1201,7 +1201,7 @@ class HDate {
|
|
|
1201
1201
|
if (ofStr) {
|
|
1202
1202
|
return ' ' + ofStr;
|
|
1203
1203
|
}
|
|
1204
|
-
if ('ashkenazi'
|
|
1204
|
+
if (locale.startsWith('ashkenazi')) {
|
|
1205
1205
|
return ' of';
|
|
1206
1206
|
}
|
|
1207
1207
|
return '';
|
|
@@ -1571,6 +1571,7 @@ class HDate {
|
|
|
1571
1571
|
case 'h':
|
|
1572
1572
|
return months.SHVAT;
|
|
1573
1573
|
}
|
|
1574
|
+
break;
|
|
1574
1575
|
case 't':
|
|
1575
1576
|
switch (c[1]) {
|
|
1576
1577
|
case 'a':
|
|
@@ -1590,9 +1591,7 @@ class HDate {
|
|
|
1590
1591
|
return months.ADAR_I;
|
|
1591
1592
|
}
|
|
1592
1593
|
return months.ADAR_II;
|
|
1593
|
-
// else assume sheini
|
|
1594
1594
|
}
|
|
1595
|
-
|
|
1596
1595
|
break;
|
|
1597
1596
|
case 'ס':
|
|
1598
1597
|
return months.SIVAN;
|
|
@@ -1951,8 +1950,7 @@ class Event {
|
|
|
1951
1950
|
*/
|
|
1952
1951
|
getCategories() {
|
|
1953
1952
|
const mask = this.getFlags();
|
|
1954
|
-
for (
|
|
1955
|
-
const attrs = flagToCategory[i];
|
|
1953
|
+
for (const attrs of flagToCategory) {
|
|
1956
1954
|
if (mask & attrs[0]) {
|
|
1957
1955
|
return attrs.slice(1);
|
|
1958
1956
|
}
|
|
@@ -1981,7 +1979,7 @@ class HebrewDateEvent extends Event {
|
|
|
1981
1979
|
* @return {string}
|
|
1982
1980
|
*/
|
|
1983
1981
|
render(locale) {
|
|
1984
|
-
const locale1 = locale
|
|
1982
|
+
const locale1 = locale === null || locale === void 0 ? void 0 : locale.toLowerCase();
|
|
1985
1983
|
const locale0 = locale1 || Locale.getLocaleName();
|
|
1986
1984
|
const hd = this.getDate();
|
|
1987
1985
|
switch (locale0) {
|
|
@@ -2008,7 +2006,7 @@ class HebrewDateEvent extends Event {
|
|
|
2008
2006
|
* @return {string}
|
|
2009
2007
|
*/
|
|
2010
2008
|
renderBrief(locale) {
|
|
2011
|
-
const locale1 = locale
|
|
2009
|
+
const locale1 = locale === null || locale === void 0 ? void 0 : locale.toLowerCase();
|
|
2012
2010
|
const locale0 = locale1 || Locale.getLocaleName();
|
|
2013
2011
|
const hd = this.getDate();
|
|
2014
2012
|
if (hd.getMonth() === months.TISHREI && hd.getDate() === 1) {
|
|
@@ -2436,7 +2434,30 @@ function pad2(number) {
|
|
|
2436
2434
|
* @property {Date} tzeit
|
|
2437
2435
|
*/
|
|
2438
2436
|
|
|
2439
|
-
/**
|
|
2437
|
+
/**
|
|
2438
|
+
* Calculate halachic times (zmanim / זְמַנִּים) for a given day and location.
|
|
2439
|
+
* Calculations are available for tzeit / tzais (nightfall),
|
|
2440
|
+
* shkiah (sunset) and more.
|
|
2441
|
+
*
|
|
2442
|
+
* Zmanim are estimated using an algorithm published by the US National Oceanic
|
|
2443
|
+
* and Atmospheric Administration. The NOAA solar calculator is based on equations
|
|
2444
|
+
* from _Astronomical Algorithms_ by Jean Meeus.
|
|
2445
|
+
*
|
|
2446
|
+
* The sunrise and sunset results are theoretically accurate to within a minute for
|
|
2447
|
+
* locations between +/- 72° latitude, and within 10 minutes outside of those latitudes.
|
|
2448
|
+
* However, due to variations in atmospheric composition, temperature, pressure and
|
|
2449
|
+
* conditions, observed values may vary from calculations.
|
|
2450
|
+
* https://gml.noaa.gov/grad/solcalc/calcdetails.html
|
|
2451
|
+
*
|
|
2452
|
+
* @example
|
|
2453
|
+
* const {Zmanim} = require('@hebcal/core');
|
|
2454
|
+
* const latitude = 41.822232;
|
|
2455
|
+
* const longitude = -71.448292;
|
|
2456
|
+
* const friday = new Date(2023, 8, 8);
|
|
2457
|
+
* const zmanim = new Zmanim(friday, latitude, longitude);
|
|
2458
|
+
* const candleLighting = zmanim.sunsetOffset(-18, true);
|
|
2459
|
+
* const timeStr = Zmanim.formatISOWithTimeZone('America/New_York', candleLighting);
|
|
2460
|
+
*/
|
|
2440
2461
|
class Zmanim {
|
|
2441
2462
|
/**
|
|
2442
2463
|
* Initialize a Zmanim instance.
|
|
@@ -2486,6 +2507,16 @@ class Zmanim {
|
|
|
2486
2507
|
tzeit: this.tzeit()
|
|
2487
2508
|
};
|
|
2488
2509
|
}
|
|
2510
|
+
/**
|
|
2511
|
+
* Convenience function to get the time when sun is above or below the horizon
|
|
2512
|
+
* for a certain angle (in degrees).
|
|
2513
|
+
* @param {number} angle
|
|
2514
|
+
* @param {boolean} rising
|
|
2515
|
+
* @return {Date}
|
|
2516
|
+
*/
|
|
2517
|
+
timeAtAngle(angle, rising) {
|
|
2518
|
+
return this.sun.timeAtAngle(angle, rising);
|
|
2519
|
+
}
|
|
2489
2520
|
/**
|
|
2490
2521
|
* Upper edge of the Sun appears over the eastern horizon in the morning (0.833° above horizon)
|
|
2491
2522
|
* @return {Date}
|
|
@@ -2642,7 +2673,7 @@ class Zmanim {
|
|
|
2642
2673
|
}
|
|
2643
2674
|
/**
|
|
2644
2675
|
* @param {number} [angle=8.5] optional time for solar depression.
|
|
2645
|
-
* Default is 8.5 degrees for 3 small stars, use 7.083
|
|
2676
|
+
* Default is 8.5 degrees for 3 small stars, use 7.083 degrees for 3 medium-sized stars.
|
|
2646
2677
|
* @return {Date}
|
|
2647
2678
|
*/
|
|
2648
2679
|
tzeit(angle = 8.5) {
|
|
@@ -2789,7 +2820,7 @@ class Zmanim {
|
|
|
2789
2820
|
* Returns an array with tzeit Date object and a 24-hour string formatted time.
|
|
2790
2821
|
* @deprecated
|
|
2791
2822
|
* @param {number} angle degrees for solar depression.
|
|
2792
|
-
* Default is 8.5 degrees for 3 small stars, use 7.083
|
|
2823
|
+
* Default is 8.5 degrees for 3 small stars, use 7.083 degrees for 3 medium-sized stars.
|
|
2793
2824
|
* @param {Intl.DateTimeFormat} timeFormat
|
|
2794
2825
|
* @return {Object[]}
|
|
2795
2826
|
*/
|
|
@@ -3122,17 +3153,6 @@ const days = {
|
|
|
3122
3153
|
SAT: 6
|
|
3123
3154
|
};
|
|
3124
3155
|
|
|
3125
|
-
/**
|
|
3126
|
-
* @private
|
|
3127
|
-
* @constant
|
|
3128
|
-
* This method returns the tzais (nightfall) based on the opinion of the
|
|
3129
|
-
* Geonim calculated as 30 minutes after sunset during the equinox
|
|
3130
|
-
* (on March 16, about 4 days before the astronomical equinox, the day that
|
|
3131
|
-
* a solar hour is 60 minutes) in Yerushalayim.
|
|
3132
|
-
* @see {https://kosherjava.com/zmanim/docs/api/com/kosherjava/zmanim/ComplexZmanimCalendar.html#getTzaisGeonim7Point083Degrees()}
|
|
3133
|
-
*/
|
|
3134
|
-
const TZEIT_3MEDIUM_STARS = 7.083;
|
|
3135
|
-
|
|
3136
3156
|
/**
|
|
3137
3157
|
* @private
|
|
3138
3158
|
* @param {Event} e
|
|
@@ -3292,10 +3312,10 @@ class CandleLightingEvent extends TimedEvent {
|
|
|
3292
3312
|
* Makes a pair of events representing fast start and end times
|
|
3293
3313
|
* @private
|
|
3294
3314
|
* @param {Event} ev
|
|
3295
|
-
* @param {
|
|
3315
|
+
* @param {CalOptions} options
|
|
3296
3316
|
* @return {Event}
|
|
3297
3317
|
*/
|
|
3298
|
-
function makeFastStartEnd(ev,
|
|
3318
|
+
function makeFastStartEnd(ev, options) {
|
|
3299
3319
|
const desc = ev.getDesc();
|
|
3300
3320
|
if (desc === 'Yom Kippur') {
|
|
3301
3321
|
return ev;
|
|
@@ -3303,17 +3323,19 @@ function makeFastStartEnd(ev, location) {
|
|
|
3303
3323
|
ev = ev.clone();
|
|
3304
3324
|
const hd = ev.getDate();
|
|
3305
3325
|
const dt = hd.greg();
|
|
3326
|
+
const location = options.location;
|
|
3327
|
+
const fastEndDeg = options.fastEndDeg;
|
|
3306
3328
|
const zmanim = new Zmanim(dt, location.getLatitude(), location.getLongitude());
|
|
3307
3329
|
if (desc === 'Erev Tish\'a B\'Av') {
|
|
3308
3330
|
const sunset = zmanim.sunset();
|
|
3309
3331
|
ev.startEvent = makeTimedEvent(hd, sunset, 'Fast begins', ev, location);
|
|
3310
|
-
} else if (desc.
|
|
3311
|
-
ev.endEvent = makeTimedEvent(hd, zmanim.tzeit(
|
|
3332
|
+
} else if (desc.startsWith('Tish\'a B\'Av')) {
|
|
3333
|
+
ev.endEvent = makeTimedEvent(hd, zmanim.tzeit(fastEndDeg), 'Fast ends', ev, location);
|
|
3312
3334
|
} else {
|
|
3313
3335
|
const dawn = zmanim.alotHaShachar();
|
|
3314
3336
|
ev.startEvent = makeTimedEvent(hd, dawn, 'Fast begins', ev, location);
|
|
3315
3337
|
if (dt.getDay() !== 5 && !(hd.getDate() === 14 && hd.getMonth() === months.NISAN)) {
|
|
3316
|
-
ev.endEvent = makeTimedEvent(hd, zmanim.tzeit(
|
|
3338
|
+
ev.endEvent = makeTimedEvent(hd, zmanim.tzeit(fastEndDeg), 'Fast ends', ev, location);
|
|
3317
3339
|
}
|
|
3318
3340
|
}
|
|
3319
3341
|
return ev;
|
|
@@ -4612,16 +4634,6 @@ const staticModernHolidays = [{
|
|
|
4612
4634
|
|
|
4613
4635
|
/** Represents a built-in holiday like Pesach, Purim or Tu BiShvat */
|
|
4614
4636
|
class HolidayEvent extends Event {
|
|
4615
|
-
/**
|
|
4616
|
-
* Constructs Holiday event
|
|
4617
|
-
* @param {HDate} date Hebrew date event occurs
|
|
4618
|
-
* @param {string} desc Description (not translated)
|
|
4619
|
-
* @param {number} [mask=0] optional holiday flags
|
|
4620
|
-
* @param {Object} [attrs={}]
|
|
4621
|
-
*/
|
|
4622
|
-
constructor(date, desc, mask, attrs) {
|
|
4623
|
-
super(date, desc, mask, attrs);
|
|
4624
|
-
}
|
|
4625
4637
|
/** @return {string} */
|
|
4626
4638
|
basename() {
|
|
4627
4639
|
return this.getDesc().replace(/ \d{4}$/, '').replace(/ \(CH''M\)$/, '').replace(/ \(observed\)$/, '').replace(/ \(Hoshana Raba\)$/, '').replace(/ [IV]+$/, '').replace(/: \d Candles?$/, '').replace(/: 8th Day$/, '').replace(/^Erev /, '');
|
|
@@ -4713,15 +4725,6 @@ class RoshChodeshEvent extends HolidayEvent {
|
|
|
4713
4725
|
* we subclass HolidayEvent to override the `url()` method.
|
|
4714
4726
|
*/
|
|
4715
4727
|
class AsaraBTevetEvent extends HolidayEvent {
|
|
4716
|
-
/**
|
|
4717
|
-
* Constructs AsaraBTevetEvent
|
|
4718
|
-
* @param {HDate} date Hebrew date event occurs
|
|
4719
|
-
* @param {string} desc Description (not translated)
|
|
4720
|
-
* @param {number} [mask=0] optional holiday flags
|
|
4721
|
-
*/
|
|
4722
|
-
constructor(date, desc, mask) {
|
|
4723
|
-
super(date, desc, mask);
|
|
4724
|
-
}
|
|
4725
4728
|
/** @return {string} */
|
|
4726
4729
|
urlDateSuffix() {
|
|
4727
4730
|
const isoDateTime = this.getDate().greg().toISOString();
|
|
@@ -5257,7 +5260,7 @@ function getBirthdayOrAnniversary_(hyear, gdate) {
|
|
|
5257
5260
|
return new HDate(day, month, hyear);
|
|
5258
5261
|
}
|
|
5259
5262
|
|
|
5260
|
-
const version="4.
|
|
5263
|
+
const version="4.5.0";
|
|
5261
5264
|
|
|
5262
5265
|
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};
|
|
5263
5266
|
|
|
@@ -5452,9 +5455,9 @@ function tachanunYear(year, il) {
|
|
|
5452
5455
|
);
|
|
5453
5456
|
|
|
5454
5457
|
return {
|
|
5455
|
-
none: none.map(hd => hd.abs()).sort(),
|
|
5456
|
-
some: some.map(hd => hd.abs()).sort(),
|
|
5457
|
-
yesPrev: yesPrev.map(hd => hd.abs()).sort()
|
|
5458
|
+
none: none.map(hd => hd.abs()).sort((a, b) => a - b),
|
|
5459
|
+
some: some.map(hd => hd.abs()).sort((a, b) => a - b),
|
|
5460
|
+
yesPrev: yesPrev.map(hd => hd.abs()).sort((a, b) => a - b)
|
|
5458
5461
|
};
|
|
5459
5462
|
}
|
|
5460
5463
|
|
|
@@ -5500,11 +5503,15 @@ const MAJOR_FAST = flags.MAJOR_FAST;
|
|
|
5500
5503
|
const ROSH_CHODESH = flags.ROSH_CHODESH;
|
|
5501
5504
|
const PARSHA_HASHAVUA = flags.PARSHA_HASHAVUA;
|
|
5502
5505
|
const DAF_YOMI = flags.DAF_YOMI;
|
|
5506
|
+
const MISHNA_YOMI = flags.MISHNA_YOMI;
|
|
5507
|
+
const NACH_YOMI = flags.NACH_YOMI;
|
|
5508
|
+
const YERUSHALMI_YOMI = flags.YERUSHALMI_YOMI;
|
|
5503
5509
|
const OMER_COUNT = flags.OMER_COUNT;
|
|
5504
5510
|
const SHABBAT_MEVARCHIM = flags.SHABBAT_MEVARCHIM;
|
|
5505
5511
|
const MINOR_HOLIDAY = flags.MINOR_HOLIDAY;
|
|
5506
5512
|
const EREV = flags.EREV;
|
|
5507
5513
|
const CHOL_HAMOED = flags.CHOL_HAMOED;
|
|
5514
|
+
const YOM_KIPPUR_KATAN = flags.YOM_KIPPUR_KATAN;
|
|
5508
5515
|
const unrecognizedAlreadyWarned = Object.create(null);
|
|
5509
5516
|
const RECOGNIZED_OPTIONS = {
|
|
5510
5517
|
location: 1,
|
|
@@ -5518,6 +5525,7 @@ const RECOGNIZED_OPTIONS = {
|
|
|
5518
5525
|
candleLightingMins: 1,
|
|
5519
5526
|
havdalahMins: 1,
|
|
5520
5527
|
havdalahDeg: 1,
|
|
5528
|
+
fastEndDeg: 1,
|
|
5521
5529
|
sedrot: 1,
|
|
5522
5530
|
il: 1,
|
|
5523
5531
|
noMinorFast: 1,
|
|
@@ -5581,6 +5589,27 @@ const geoIdCandleOffset = {
|
|
|
5581
5589
|
'293067': 30 // Zikhron Yaakov
|
|
5582
5590
|
};
|
|
5583
5591
|
|
|
5592
|
+
/**
|
|
5593
|
+
* @private
|
|
5594
|
+
* @constant
|
|
5595
|
+
* This calculation is based on the position of the sun 36 minutes after sunset in Jerusalem
|
|
5596
|
+
* around the equinox / equilux, which is 8.5° below geometric zenith.
|
|
5597
|
+
* The Ohr Meir considers this the time that 3 small stars are visible,
|
|
5598
|
+
* which is later than the required 3 medium stars.
|
|
5599
|
+
* @see {https://kosherjava.com/zmanim/docs/api/com/kosherjava/zmanim/ZmanimCalendar.html#ZENITH_8_POINT_5}
|
|
5600
|
+
*/
|
|
5601
|
+
const TZEIT_3SMALL_STARS = 8.5;
|
|
5602
|
+
|
|
5603
|
+
/**
|
|
5604
|
+
* @private
|
|
5605
|
+
* @constant
|
|
5606
|
+
* This calculation is based on observation of 3 medium sized stars by Dr. Baruch Cohen
|
|
5607
|
+
* in his calendar published in in 1899 in Strasbourg, France.
|
|
5608
|
+
* This calculates to 7.0833333° below geometric zenith.
|
|
5609
|
+
* @see {https://kosherjava.com/zmanim/docs/api/com/kosherjava/zmanim/ComplexZmanimCalendar.html#ZENITH_7_POINT_083}
|
|
5610
|
+
*/
|
|
5611
|
+
const TZEIT_3MEDIUM_STARS = 7.0833333;
|
|
5612
|
+
|
|
5584
5613
|
/**
|
|
5585
5614
|
* Modifies options in-place
|
|
5586
5615
|
* @private
|
|
@@ -5591,7 +5620,7 @@ function checkCandleOptions(options) {
|
|
|
5591
5620
|
return;
|
|
5592
5621
|
}
|
|
5593
5622
|
const location = options.location;
|
|
5594
|
-
if (typeof location === 'undefined' || !location instanceof Location) {
|
|
5623
|
+
if (typeof location === 'undefined' || !(location instanceof Location)) {
|
|
5595
5624
|
throw new TypeError('options.candlelighting requires valid options.location');
|
|
5596
5625
|
}
|
|
5597
5626
|
if (typeof options.havdalahMins === 'number' && typeof options.havdalahDeg === 'number') {
|
|
@@ -5615,7 +5644,10 @@ function checkCandleOptions(options) {
|
|
|
5615
5644
|
} else if (typeof options.havdalahDeg === 'number') {
|
|
5616
5645
|
options.havdalahDeg = Math.abs(options.havdalahDeg);
|
|
5617
5646
|
} else {
|
|
5618
|
-
options.havdalahDeg =
|
|
5647
|
+
options.havdalahDeg = TZEIT_3SMALL_STARS;
|
|
5648
|
+
}
|
|
5649
|
+
if (typeof options.fastEndDeg !== 'number') {
|
|
5650
|
+
options.fastEndDeg = TZEIT_3MEDIUM_STARS;
|
|
5619
5651
|
}
|
|
5620
5652
|
}
|
|
5621
5653
|
|
|
@@ -5634,10 +5666,14 @@ function checkCandleOptions(options) {
|
|
|
5634
5666
|
* @property {number} havdalahMins - minutes after sundown for Havdalah (typical values are 42, 50, or 72).
|
|
5635
5667
|
* If `undefined` (the default), calculate Havdalah according to Tzeit Hakochavim -
|
|
5636
5668
|
* Nightfall (the point when 3 small stars are observable in the night time sky with
|
|
5637
|
-
* the naked eye). If `0`, Havdalah times are
|
|
5669
|
+
* the naked eye). If `0`, Havdalah times are suppressed.
|
|
5638
5670
|
* @property {number} havdalahDeg - degrees for solar depression for Havdalah.
|
|
5639
|
-
* Default is 8.5 degrees for 3 small stars. use 7.083
|
|
5640
|
-
*
|
|
5671
|
+
* Default is 8.5 degrees for 3 small stars. use 7.083 degrees for 3 medium-sized stars
|
|
5672
|
+
* (observed by Dr. Baruch (Berthold) Cohn in his luach published in France in 1899).
|
|
5673
|
+
* If `0`, Havdalah times are suppressed.
|
|
5674
|
+
* @property {number} fastEndDeg - degrees for solar depression for end of fast days.
|
|
5675
|
+
* Default is 7.083 degrees for 3 medium-sized stars. Other commonly-used values include
|
|
5676
|
+
* 6.45 degrees, as calculated by Rabbi Yechiel Michel Tucazinsky.
|
|
5641
5677
|
* @property {boolean} sedrot - calculate parashah hashavua on Saturdays
|
|
5642
5678
|
* @property {boolean} il - Israeli holiday and sedra schedule
|
|
5643
5679
|
* @property {boolean} noMinorFast - suppress minor fasts
|
|
@@ -5758,36 +5794,11 @@ function getStartAndEnd(options) {
|
|
|
5758
5794
|
* @return {number}
|
|
5759
5795
|
*/
|
|
5760
5796
|
function getMaskFromOptions(options) {
|
|
5797
|
+
var _options$location;
|
|
5761
5798
|
if (typeof options.mask === 'number') {
|
|
5762
|
-
|
|
5763
|
-
if (m & ROSH_CHODESH) delete options.noRoshChodesh;
|
|
5764
|
-
if (m & MODERN_HOLIDAY) delete options.noModern;
|
|
5765
|
-
if (m & MINOR_FAST) delete options.noMinorFast;
|
|
5766
|
-
if (m & SPECIAL_SHABBAT) delete options.noSpecialShabbat;
|
|
5767
|
-
if (m & PARSHA_HASHAVUA) options.sedrot = true;
|
|
5768
|
-
if (m & DAF_YOMI) {
|
|
5769
|
-
options.dailyLearning = options.dailyLearning || {};
|
|
5770
|
-
options.dailyLearning.dafYomi = true;
|
|
5771
|
-
}
|
|
5772
|
-
if (m & OMER_COUNT) options.omer = true;
|
|
5773
|
-
if (m & SHABBAT_MEVARCHIM) options.shabbatMevarchim = true;
|
|
5774
|
-
if (m & flags.MISHNA_YOMI) {
|
|
5775
|
-
options.dailyLearning = options.dailyLearning || {};
|
|
5776
|
-
options.dailyLearning.mishnaYomi = true;
|
|
5777
|
-
}
|
|
5778
|
-
if (m & flags.NACH_YOMI) {
|
|
5779
|
-
options.dailyLearning = options.dailyLearning || {};
|
|
5780
|
-
options.dailyLearning.nachYomi = true;
|
|
5781
|
-
}
|
|
5782
|
-
if (m & flags.YOM_KIPPUR_KATAN) options.yomKippurKatan = true;
|
|
5783
|
-
if (m & flags.YERUSHALMI_YOMI) {
|
|
5784
|
-
options.dailyLearning = options.dailyLearning || {};
|
|
5785
|
-
options.dailyLearning.yerushalmi = 1;
|
|
5786
|
-
}
|
|
5787
|
-
options.userMask = true;
|
|
5788
|
-
return m;
|
|
5799
|
+
return setOptionsFromMask(options);
|
|
5789
5800
|
}
|
|
5790
|
-
const il = options.il ||
|
|
5801
|
+
const il = options.il || ((_options$location = options.location) === null || _options$location === void 0 ? void 0 : _options$location.il) || false;
|
|
5791
5802
|
let mask = 0;
|
|
5792
5803
|
|
|
5793
5804
|
// default options
|
|
@@ -5827,7 +5838,7 @@ function getMaskFromOptions(options) {
|
|
|
5827
5838
|
mask |= SHABBAT_MEVARCHIM;
|
|
5828
5839
|
}
|
|
5829
5840
|
if (options.yomKippurKatan) {
|
|
5830
|
-
mask |=
|
|
5841
|
+
mask |= YOM_KIPPUR_KATAN;
|
|
5831
5842
|
}
|
|
5832
5843
|
if (options.dailyLearning) {
|
|
5833
5844
|
const dailyLearning = options.dailyLearning;
|
|
@@ -5835,13 +5846,13 @@ function getMaskFromOptions(options) {
|
|
|
5835
5846
|
mask |= DAF_YOMI;
|
|
5836
5847
|
}
|
|
5837
5848
|
if (dailyLearning.mishnaYomi) {
|
|
5838
|
-
mask |=
|
|
5849
|
+
mask |= MISHNA_YOMI;
|
|
5839
5850
|
}
|
|
5840
5851
|
if (dailyLearning.nachYomi) {
|
|
5841
|
-
mask |=
|
|
5852
|
+
mask |= NACH_YOMI;
|
|
5842
5853
|
}
|
|
5843
5854
|
if (dailyLearning.yerushalmi) {
|
|
5844
|
-
mask |=
|
|
5855
|
+
mask |= YERUSHALMI_YOMI;
|
|
5845
5856
|
}
|
|
5846
5857
|
}
|
|
5847
5858
|
return mask;
|
|
@@ -5863,6 +5874,40 @@ const hour12cc = {
|
|
|
5863
5874
|
ZA: 1
|
|
5864
5875
|
};
|
|
5865
5876
|
|
|
5877
|
+
/**
|
|
5878
|
+
* @private
|
|
5879
|
+
* @param {CalOptions} options
|
|
5880
|
+
* @return {number}
|
|
5881
|
+
*/
|
|
5882
|
+
function setOptionsFromMask(options) {
|
|
5883
|
+
const m = options.mask;
|
|
5884
|
+
if (m & ROSH_CHODESH) delete options.noRoshChodesh;
|
|
5885
|
+
if (m & MODERN_HOLIDAY) delete options.noModern;
|
|
5886
|
+
if (m & MINOR_FAST) delete options.noMinorFast;
|
|
5887
|
+
if (m & SPECIAL_SHABBAT) delete options.noSpecialShabbat;
|
|
5888
|
+
if (m & PARSHA_HASHAVUA) options.sedrot = true;
|
|
5889
|
+
if (m & (DAF_YOMI | MISHNA_YOMI | NACH_YOMI | YERUSHALMI_YOMI)) {
|
|
5890
|
+
options.dailyLearning = options.dailyLearning || {};
|
|
5891
|
+
if (m & DAF_YOMI) {
|
|
5892
|
+
options.dailyLearning.dafYomi = true;
|
|
5893
|
+
}
|
|
5894
|
+
if (m & MISHNA_YOMI) {
|
|
5895
|
+
options.dailyLearning.mishnaYomi = true;
|
|
5896
|
+
}
|
|
5897
|
+
if (m & NACH_YOMI) {
|
|
5898
|
+
options.dailyLearning.nachYomi = true;
|
|
5899
|
+
}
|
|
5900
|
+
if (m & YERUSHALMI_YOMI) {
|
|
5901
|
+
options.dailyLearning.yerushalmi = 1;
|
|
5902
|
+
}
|
|
5903
|
+
}
|
|
5904
|
+
if (m & OMER_COUNT) options.omer = true;
|
|
5905
|
+
if (m & SHABBAT_MEVARCHIM) options.shabbatMevarchim = true;
|
|
5906
|
+
if (m & YOM_KIPPUR_KATAN) options.yomKippurKatan = true;
|
|
5907
|
+
options.userMask = true;
|
|
5908
|
+
return m;
|
|
5909
|
+
}
|
|
5910
|
+
|
|
5866
5911
|
/**
|
|
5867
5912
|
* @private
|
|
5868
5913
|
* @param {Event} ev
|
|
@@ -5949,10 +5994,10 @@ class HebrewCalendar {
|
|
|
5949
5994
|
* These defaults can be changed using these options:
|
|
5950
5995
|
* * `options.candleLightingMins` - minutes before sundown to light candles
|
|
5951
5996
|
* * `options.havdalahMins` - minutes after sundown for Havdalah (typical values are 42, 50, or 72).
|
|
5952
|
-
* Havdalah times are
|
|
5997
|
+
* Havdalah times are suppressed when `options.havdalahMins=0`.
|
|
5953
5998
|
* * `options.havdalahDeg` - degrees for solar depression for Havdalah.
|
|
5954
|
-
* Default is 8.5 degrees for 3 small stars. Use 7.083
|
|
5955
|
-
* Havdalah times are
|
|
5999
|
+
* Default is 8.5 degrees for 3 small stars. Use 7.083 degrees for 3 medium-sized stars.
|
|
6000
|
+
* Havdalah times are suppressed when `options.havdalahDeg=0`.
|
|
5956
6001
|
*
|
|
5957
6002
|
* If both `options.candlelighting=true` and `options.location` is specified,
|
|
5958
6003
|
* Chanukah candle-lighting times and minor fast start/end times will also be generated.
|
|
@@ -6045,7 +6090,7 @@ class HebrewCalendar {
|
|
|
6045
6090
|
}
|
|
6046
6091
|
const prevEventsLength = evts.length;
|
|
6047
6092
|
const dow = hd.getDay();
|
|
6048
|
-
let candlesEv
|
|
6093
|
+
let candlesEv;
|
|
6049
6094
|
const ev = holidaysYear.get(hd.toString()) || [];
|
|
6050
6095
|
ev.forEach(e => {
|
|
6051
6096
|
candlesEv = appendHolidayAndRelated(evts, e, options, candlesEv, dow);
|
|
@@ -6249,8 +6294,9 @@ class HebrewCalendar {
|
|
|
6249
6294
|
* @return {string}
|
|
6250
6295
|
*/
|
|
6251
6296
|
static reformatTimeStr(timeStr, suffix, options) {
|
|
6297
|
+
var _options$location2;
|
|
6252
6298
|
if (typeof timeStr !== 'string') throw new TypeError(`Bad timeStr: ${timeStr}`);
|
|
6253
|
-
const cc = options.location
|
|
6299
|
+
const cc = ((_options$location2 = options.location) === null || _options$location2 === void 0 ? void 0 : _options$location2.cc) || (options.il ? 'IL' : 'US');
|
|
6254
6300
|
if (typeof options.hour12 !== 'undefined' && !options.hour12) {
|
|
6255
6301
|
return timeStr;
|
|
6256
6302
|
}
|
|
@@ -6354,7 +6400,7 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
|
|
|
6354
6400
|
}
|
|
6355
6401
|
|
|
6356
6402
|
const eFlags = ev.getFlags();
|
|
6357
|
-
if (!options.yomKippurKatan && eFlags &
|
|
6403
|
+
if (!options.yomKippurKatan && eFlags & YOM_KIPPUR_KATAN || options.noModern && eFlags & MODERN_HOLIDAY) {
|
|
6358
6404
|
return candlesEv; // bail out early
|
|
6359
6405
|
}
|
|
6360
6406
|
|
|
@@ -6362,7 +6408,7 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
|
|
|
6362
6408
|
const isMajorFast = Boolean(eFlags & MAJOR_FAST);
|
|
6363
6409
|
const isMinorFast = Boolean(eFlags & MINOR_FAST);
|
|
6364
6410
|
if (options.candlelighting && (isMajorFast || isMinorFast)) {
|
|
6365
|
-
ev = makeFastStartEnd(ev,
|
|
6411
|
+
ev = makeFastStartEnd(ev, options);
|
|
6366
6412
|
if (ev.startEvent && (isMajorFast || isMinorFast && !options.noMinorFast)) {
|
|
6367
6413
|
events.push(ev.startEvent);
|
|
6368
6414
|
}
|
|
@@ -6386,9 +6432,7 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
|
|
|
6386
6432
|
candlesEv = undefined;
|
|
6387
6433
|
}
|
|
6388
6434
|
}
|
|
6389
|
-
if (options.yomKippurKatan && eFlags &
|
|
6390
|
-
events.push(ev);
|
|
6391
|
-
} else if (!options.noHolidays) {
|
|
6435
|
+
if (!options.noHolidays || options.yomKippurKatan && eFlags & YOM_KIPPUR_KATAN) {
|
|
6392
6436
|
events.push(ev); // the original event itself
|
|
6393
6437
|
}
|
|
6394
6438
|
}
|
package/hebcal.d.ts
CHANGED
|
@@ -306,7 +306,7 @@ declare module '@hebcal/core' {
|
|
|
306
306
|
/**
|
|
307
307
|
* @deprecated
|
|
308
308
|
* @param [angle=8.5] optional time for solar depression.
|
|
309
|
-
* Default is 8.5 degrees for 3 small stars, use 7.083
|
|
309
|
+
* Default is 8.5 degrees for 3 small stars, use 7.083 degrees for 3 medium-sized stars.
|
|
310
310
|
*/
|
|
311
311
|
tzeit(hdate: Date | HDate, angle?: number): Date;
|
|
312
312
|
/**
|
|
@@ -361,12 +361,19 @@ declare module '@hebcal/core' {
|
|
|
361
361
|
}
|
|
362
362
|
|
|
363
363
|
/**
|
|
364
|
-
*
|
|
364
|
+
* Calculate halachic times (zmanim / זְמַנִּים) for a given day and location.
|
|
365
|
+
* Calculations are available for tzeit / tzais (nightfall),
|
|
366
|
+
* shkiah (sunset) and more.
|
|
367
|
+
*
|
|
368
|
+
* Zmanim are estimated using an algorithm published by the US National
|
|
369
|
+
* Oceanic and Atmospheric Administration. The NOAA solar calculator is
|
|
370
|
+
* based on equations from _Astronomical Algorithms_ by Jean Meeus.
|
|
365
371
|
*/
|
|
366
372
|
export class Zmanim {
|
|
367
373
|
/**
|
|
368
374
|
* Initialize a Zmanim instance
|
|
369
|
-
* @param date Regular or Hebrew Date
|
|
375
|
+
* @param date Regular or Hebrew Date. If `date` is a regular `Date`,
|
|
376
|
+
* hours, minutes, seconds and milliseconds are ignored
|
|
370
377
|
* @param latitude
|
|
371
378
|
* @param longitude
|
|
372
379
|
*/
|
|
@@ -389,6 +396,12 @@ declare module '@hebcal/core' {
|
|
|
389
396
|
*/
|
|
390
397
|
static timeZoneOffset(tzid: string, date: Date): string;
|
|
391
398
|
|
|
399
|
+
/**
|
|
400
|
+
* Convenience function to get the time when sun is above or below the
|
|
401
|
+
* horizon for a certain angle (in degrees).
|
|
402
|
+
*/
|
|
403
|
+
timeAtAngle(angle: number, rising: boolean): Date;
|
|
404
|
+
|
|
392
405
|
/** @deprecated */
|
|
393
406
|
suntime(): ZmanimTimesResult;
|
|
394
407
|
/** Upper edge of the Sun appears over the eastern horizon in the morning (0.833° above horizon) */
|
|
@@ -431,7 +444,7 @@ declare module '@hebcal/core' {
|
|
|
431
444
|
plagHaMincha(): Date;
|
|
432
445
|
/**
|
|
433
446
|
* @param [angle=8.5] optional time for solar depression.
|
|
434
|
-
* Default is 8.5 degrees for 3 small stars, use 7.083
|
|
447
|
+
* Default is 8.5 degrees for 3 small stars, use 7.083 degrees for 3 medium-sized stars.
|
|
435
448
|
*/
|
|
436
449
|
tzeit(angle?: number): Date;
|
|
437
450
|
/** Alias for sunrise */
|
|
@@ -459,7 +472,7 @@ declare module '@hebcal/core' {
|
|
|
459
472
|
* Returns an array with tzeit Date object and a 24-hour string formatted time.
|
|
460
473
|
* @deprecated
|
|
461
474
|
* @param angle optional time for solar depression.
|
|
462
|
-
* Default is 8.5 degrees for 3 small stars, use 7.083
|
|
475
|
+
* Default is 8.5 degrees for 3 small stars, use 7.083 degrees for 3 medium-sized stars.
|
|
463
476
|
*/
|
|
464
477
|
tzeitTime(angle: number, timeFormat: Intl.DateTimeFormat): any[];
|
|
465
478
|
}
|
|
@@ -577,16 +590,24 @@ declare module '@hebcal/core' {
|
|
|
577
590
|
* minutes after sundown for Havdalah (typical values are 42, 50, or 72).
|
|
578
591
|
* If `undefined` (the default), calculate Havdalah according to Tzeit Hakochavim -
|
|
579
592
|
* Nightfall (the point when 3 small stars are observable in the night time sky with
|
|
580
|
-
* the naked eye). If `0`, Havdalah times are
|
|
593
|
+
* the naked eye). If `0`, Havdalah times are suppressed.
|
|
581
594
|
*/
|
|
582
595
|
havdalahMins?: number;
|
|
583
596
|
/**
|
|
584
597
|
* degrees for solar depression for Havdalah.
|
|
585
598
|
* Default is 8.5 degrees for 3 small stars.
|
|
586
|
-
* Use 7.083
|
|
587
|
-
*
|
|
599
|
+
* Use 7.083 degrees for 3 medium-sized stars (as observed by Dr. Baruch
|
|
600
|
+
* (Berthold) Cohn in his luach published in France in 1899).
|
|
601
|
+
* Havdalah times are suppressed when `havdalahDeg=0`.
|
|
588
602
|
*/
|
|
589
603
|
havdalahDeg?: number;
|
|
604
|
+
/**
|
|
605
|
+
* fastEndDeg - degrees for solar depression for end of fast days.
|
|
606
|
+
* Default is 7.083 degrees for 3 medium-sized stars. Another
|
|
607
|
+
* commonly-used value is 6.45 degrees, as calculated by Rabbi
|
|
608
|
+
* Yechiel Michel Tucazinsky.
|
|
609
|
+
*/
|
|
610
|
+
fastEndDeg?: number;
|
|
590
611
|
/** calculate parashah hashavua on Saturdays */
|
|
591
612
|
sedrot?: boolean;
|
|
592
613
|
/** Israeli holiday and sedra schedule */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hebcal/core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0",
|
|
4
4
|
"author": "Michael J. Radwin (https://github.com/mjradwin)",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Eyal Schachter (https://github.com/Scimonster)",
|
|
@@ -40,7 +40,6 @@
|
|
|
40
40
|
],
|
|
41
41
|
"scripts": {
|
|
42
42
|
"build:rollup": "rollup -c",
|
|
43
|
-
"build:babel": "babel src --out-dir dist --source-maps",
|
|
44
43
|
"build": "npm run po2json && npm run build:rollup",
|
|
45
44
|
"prepublish": "npm run build",
|
|
46
45
|
"po2json": "node ./po2json.js po/*.po",
|
|
@@ -61,23 +60,23 @@
|
|
|
61
60
|
"verbose": true
|
|
62
61
|
},
|
|
63
62
|
"devDependencies": {
|
|
64
|
-
"@babel/core": "^7.23.
|
|
65
|
-
"@babel/preset-env": "^7.
|
|
63
|
+
"@babel/core": "^7.23.2",
|
|
64
|
+
"@babel/preset-env": "^7.23.2",
|
|
66
65
|
"@babel/register": "^7.22.15",
|
|
67
66
|
"@hebcal/solar-calc": "^1.1.2",
|
|
68
|
-
"@rollup/plugin-babel": "^6.0.
|
|
69
|
-
"@rollup/plugin-commonjs": "^25.0.
|
|
70
|
-
"@rollup/plugin-json": "^6.0.
|
|
71
|
-
"@rollup/plugin-node-resolve": "^15.2.
|
|
72
|
-
"@rollup/plugin-terser": "^0.4.
|
|
67
|
+
"@rollup/plugin-babel": "^6.0.4",
|
|
68
|
+
"@rollup/plugin-commonjs": "^25.0.7",
|
|
69
|
+
"@rollup/plugin-json": "^6.0.1",
|
|
70
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
71
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
73
72
|
"ava": "^5.3.1",
|
|
74
|
-
"core-js": "^3.33.
|
|
75
|
-
"eslint": "^8.
|
|
73
|
+
"core-js": "^3.33.2",
|
|
74
|
+
"eslint": "^8.52.0",
|
|
76
75
|
"eslint-config-google": "^0.14.0",
|
|
77
76
|
"jsdoc": "^4.0.2",
|
|
78
77
|
"jsdoc-to-markdown": "^8.0.0",
|
|
79
78
|
"nyc": "^15.1.0",
|
|
80
|
-
"rollup": "^
|
|
79
|
+
"rollup": "^4.2.0",
|
|
81
80
|
"ttag-cli": "^1.10.6"
|
|
82
81
|
}
|
|
83
82
|
}
|