@hebcal/core 3.41.1 → 3.41.4
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 +15 -4
- package/dist/bundle.js +94 -62
- package/dist/bundle.min.js +2 -2
- package/dist/greg0.mjs +20 -33
- package/dist/hdate-bundle.js +41 -37
- package/dist/hdate-bundle.min.js +2 -2
- package/dist/hdate.js +40 -36
- package/dist/hdate.mjs +34 -34
- package/dist/hdate0-bundle.js +21 -34
- package/dist/hdate0-bundle.min.js +2 -2
- package/dist/hdate0.mjs +19 -32
- package/dist/index.js +73 -46
- package/dist/index.mjs +73 -46
- package/hebcal.d.ts +2 -0
- package/package.json +5 -5
package/dist/hdate0.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v3.41.
|
|
1
|
+
/*! @hebcal/core v3.41.3 */
|
|
2
2
|
/*
|
|
3
3
|
* More minimal greg routines
|
|
4
4
|
*/
|
|
@@ -52,27 +52,10 @@ function isDate(obj) {
|
|
|
52
52
|
return typeof obj === 'object' && Date.prototype === obj.__proto__;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
* @return {number}
|
|
60
|
-
*/
|
|
61
|
-
function dayOfYear(date) {
|
|
62
|
-
if (!isDate(date)) {
|
|
63
|
-
throw new TypeError(`Argument not a Date: ${date}`);
|
|
64
|
-
}
|
|
65
|
-
const month = date.getMonth();
|
|
66
|
-
let doy = date.getDate() + 31 * month;
|
|
67
|
-
if (month > 1) {
|
|
68
|
-
// FEB
|
|
69
|
-
doy -= Math.floor((4 * (month + 1) + 23) / 10);
|
|
70
|
-
if (isLeapYear$1(date.getFullYear())) {
|
|
71
|
-
doy++;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return doy;
|
|
75
|
-
}
|
|
55
|
+
/*
|
|
56
|
+
const ABS_14SEP1752 = 639797;
|
|
57
|
+
const ABS_2SEP1752 = 639785;
|
|
58
|
+
*/
|
|
76
59
|
|
|
77
60
|
/**
|
|
78
61
|
* Converts Gregorian date to absolute R.D. (Rata Die) days
|
|
@@ -84,14 +67,13 @@ function greg2abs(date) {
|
|
|
84
67
|
if (!isDate(date)) {
|
|
85
68
|
throw new TypeError(`Argument not a Date: ${date}`);
|
|
86
69
|
}
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
); // + Gregorian leap years
|
|
70
|
+
const abs = toFixed(date.getFullYear(), date.getMonth() + 1, date.getDate());
|
|
71
|
+
/*
|
|
72
|
+
if (abs < ABS_14SEP1752 && abs > ABS_2SEP1752) {
|
|
73
|
+
throw new RangeError(`Invalid Date: ${date}`);
|
|
74
|
+
}
|
|
75
|
+
*/
|
|
76
|
+
return abs;
|
|
95
77
|
}
|
|
96
78
|
|
|
97
79
|
/**
|
|
@@ -115,8 +97,8 @@ function yearFromFixed(abs) {
|
|
|
115
97
|
/**
|
|
116
98
|
* @private
|
|
117
99
|
* @param {number} year
|
|
118
|
-
* @param {number} month
|
|
119
|
-
* @param {number} day
|
|
100
|
+
* @param {number} month (1-12)
|
|
101
|
+
* @param {number} day (1-31)
|
|
120
102
|
* @return {number}
|
|
121
103
|
*/
|
|
122
104
|
function toFixed(year, month, day) {
|
|
@@ -145,6 +127,11 @@ function abs2greg(abs) {
|
|
|
145
127
|
throw new TypeError(`Argument not a Number: ${abs}`);
|
|
146
128
|
}
|
|
147
129
|
abs = Math.trunc(abs);
|
|
130
|
+
/*
|
|
131
|
+
if (abs < ABS_14SEP1752 && abs > ABS_2SEP1752) {
|
|
132
|
+
throw new RangeError(`Invalid Date: ${abs}`);
|
|
133
|
+
}
|
|
134
|
+
*/
|
|
148
135
|
const year = yearFromFixed(abs);
|
|
149
136
|
const priorDays = abs - toFixed(year, 1, 1);
|
|
150
137
|
const correction = abs < toFixed(year, 3, 1) ? 0 : (isLeapYear$1(year) ? 1 : 2);
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v3.41.
|
|
1
|
+
/*! @hebcal/core v3.41.3 */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
@@ -81,32 +81,11 @@ function daysInMonth$1(month, year) {
|
|
|
81
81
|
function isDate(obj) {
|
|
82
82
|
return typeof obj === 'object' && Date.prototype === obj.__proto__;
|
|
83
83
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
* @return {number}
|
|
89
|
-
*/
|
|
90
|
-
|
|
91
|
-
function dayOfYear(date) {
|
|
92
|
-
if (!isDate(date)) {
|
|
93
|
-
throw new TypeError(`Argument not a Date: ${date}`);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
const month = date.getMonth();
|
|
97
|
-
let doy = date.getDate() + 31 * month;
|
|
98
|
-
|
|
99
|
-
if (month > 1) {
|
|
100
|
-
// FEB
|
|
101
|
-
doy -= Math.floor((4 * (month + 1) + 23) / 10);
|
|
102
|
-
|
|
103
|
-
if (isLeapYear$1(date.getFullYear())) {
|
|
104
|
-
doy++;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
84
|
+
/*
|
|
85
|
+
const ABS_14SEP1752 = 639797;
|
|
86
|
+
const ABS_2SEP1752 = 639785;
|
|
87
|
+
*/
|
|
107
88
|
|
|
108
|
-
return doy;
|
|
109
|
-
}
|
|
110
89
|
/**
|
|
111
90
|
* Converts Gregorian date to absolute R.D. (Rata Die) days
|
|
112
91
|
* @private
|
|
@@ -119,12 +98,14 @@ function greg2abs(date) {
|
|
|
119
98
|
throw new TypeError(`Argument not a Date: ${date}`);
|
|
120
99
|
}
|
|
121
100
|
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
101
|
+
const abs = toFixed(date.getFullYear(), date.getMonth() + 1, date.getDate());
|
|
102
|
+
/*
|
|
103
|
+
if (abs < ABS_14SEP1752 && abs > ABS_2SEP1752) {
|
|
104
|
+
throw new RangeError(`Invalid Date: ${date}`);
|
|
105
|
+
}
|
|
106
|
+
*/
|
|
107
|
+
|
|
108
|
+
return abs;
|
|
128
109
|
}
|
|
129
110
|
/**
|
|
130
111
|
* @private
|
|
@@ -147,8 +128,8 @@ function yearFromFixed(abs) {
|
|
|
147
128
|
/**
|
|
148
129
|
* @private
|
|
149
130
|
* @param {number} year
|
|
150
|
-
* @param {number} month
|
|
151
|
-
* @param {number} day
|
|
131
|
+
* @param {number} month (1-12)
|
|
132
|
+
* @param {number} day (1-31)
|
|
152
133
|
* @return {number}
|
|
153
134
|
*/
|
|
154
135
|
|
|
@@ -175,6 +156,12 @@ function abs2greg(abs) {
|
|
|
175
156
|
}
|
|
176
157
|
|
|
177
158
|
abs = Math.trunc(abs);
|
|
159
|
+
/*
|
|
160
|
+
if (abs < ABS_14SEP1752 && abs > ABS_2SEP1752) {
|
|
161
|
+
throw new RangeError(`Invalid Date: ${abs}`);
|
|
162
|
+
}
|
|
163
|
+
*/
|
|
164
|
+
|
|
178
165
|
const year = yearFromFixed(abs);
|
|
179
166
|
const priorDays = abs - toFixed(year, 1, 1);
|
|
180
167
|
const correction = abs < toFixed(year, 3, 1) ? 0 : isLeapYear$1(year) ? 1 : 2;
|
|
@@ -231,13 +218,30 @@ class greg {
|
|
|
231
218
|
}
|
|
232
219
|
/**
|
|
233
220
|
* Returns number of days since January 1 of that year
|
|
221
|
+
* @deprecated
|
|
234
222
|
* @param {Date} date Gregorian date
|
|
235
223
|
* @return {number}
|
|
236
224
|
*/
|
|
237
225
|
|
|
238
226
|
|
|
239
227
|
static dayOfYear(date) {
|
|
240
|
-
|
|
228
|
+
if (!isDate(date)) {
|
|
229
|
+
throw new TypeError(`Argument not a Date: ${date}`);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
const month = date.getMonth();
|
|
233
|
+
let doy = date.getDate() + 31 * month;
|
|
234
|
+
|
|
235
|
+
if (month > 1) {
|
|
236
|
+
// FEB
|
|
237
|
+
doy -= Math.floor((4 * (month + 1) + 23) / 10);
|
|
238
|
+
|
|
239
|
+
if (isLeapYear$1(date.getFullYear())) {
|
|
240
|
+
doy++;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
return doy;
|
|
241
245
|
}
|
|
242
246
|
/**
|
|
243
247
|
* Converts Gregorian date to absolute R.D. (Rata Die) days
|
|
@@ -1930,7 +1934,10 @@ const flags = {
|
|
|
1930
1934
|
CHOL_HAMOED: 0x200000,
|
|
1931
1935
|
|
|
1932
1936
|
/** Mishna Yomi */
|
|
1933
|
-
MISHNA_YOMI: 0x400000
|
|
1937
|
+
MISHNA_YOMI: 0x400000,
|
|
1938
|
+
|
|
1939
|
+
/** Yom Kippur Katan, minor day of atonement on the day preceeding each Rosh Chodesh */
|
|
1940
|
+
YOM_KIPPUR_KATAN: 0x800000
|
|
1934
1941
|
};
|
|
1935
1942
|
/** Represents an Event with a title, date, and flags */
|
|
1936
1943
|
|
|
@@ -3351,6 +3358,7 @@ class Location {
|
|
|
3351
3358
|
}
|
|
3352
3359
|
/**
|
|
3353
3360
|
* Builds a city description from geonameid string components
|
|
3361
|
+
* @deprecated
|
|
3354
3362
|
* @param {string} cityName e.g. 'Tel Aviv' or 'Chicago'
|
|
3355
3363
|
* @param {string} admin1 e.g. 'England' or 'Massachusetts'
|
|
3356
3364
|
* @param {string} countryName full country name, e.g. 'Israel' or 'United States'
|
|
@@ -4833,6 +4841,12 @@ class MevarchimChodeshEvent extends Event {
|
|
|
4833
4841
|
const molad = new MoladEvent(date, hyear, monNext);
|
|
4834
4842
|
this.memo = molad.render();
|
|
4835
4843
|
}
|
|
4844
|
+
/** @return {string} */
|
|
4845
|
+
|
|
4846
|
+
|
|
4847
|
+
basename() {
|
|
4848
|
+
return this.getDesc();
|
|
4849
|
+
}
|
|
4836
4850
|
/**
|
|
4837
4851
|
* Returns (translated) description of this event
|
|
4838
4852
|
* @param {string} [locale] Optional locale name (defaults to active locale).
|
|
@@ -4882,10 +4896,16 @@ class YomKippurKatanEvent extends HolidayEvent {
|
|
|
4882
4896
|
* @param {string} nextMonthName name of the upcoming month
|
|
4883
4897
|
*/
|
|
4884
4898
|
constructor(date, nextMonthName) {
|
|
4885
|
-
super(date, `${ykk} ${nextMonthName}`, flags.MINOR_FAST);
|
|
4899
|
+
super(date, `${ykk} ${nextMonthName}`, flags.MINOR_FAST | flags.YOM_KIPPUR_KATAN);
|
|
4886
4900
|
this.nextMonthName = nextMonthName;
|
|
4887
4901
|
this.memo = `Minor Day of Atonement on the day preceeding Rosh Chodesh ${nextMonthName}`;
|
|
4888
4902
|
}
|
|
4903
|
+
/** @return {string} */
|
|
4904
|
+
|
|
4905
|
+
|
|
4906
|
+
basename() {
|
|
4907
|
+
return this.getDesc();
|
|
4908
|
+
}
|
|
4889
4909
|
/**
|
|
4890
4910
|
* @param {string} [locale] Optional locale name (defaults to active locale).
|
|
4891
4911
|
* @return {string}
|
|
@@ -4907,10 +4927,8 @@ class YomKippurKatanEvent extends HolidayEvent {
|
|
|
4907
4927
|
/** @return {string} */
|
|
4908
4928
|
|
|
4909
4929
|
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
const isoDate = isoDateTime.substring(0, isoDateTime.indexOf('T'));
|
|
4913
|
-
return isoDate.replace(/-/g, '');
|
|
4930
|
+
url() {
|
|
4931
|
+
return undefined;
|
|
4914
4932
|
}
|
|
4915
4933
|
|
|
4916
4934
|
}
|
|
@@ -5595,9 +5613,9 @@ function getBirthdayOrAnniversary_(hyear, gdate) {
|
|
|
5595
5613
|
return new HDate(day, month, hyear);
|
|
5596
5614
|
}
|
|
5597
5615
|
|
|
5598
|
-
var version="3.41.
|
|
5616
|
+
var version="3.41.3";
|
|
5599
5617
|
|
|
5600
|
-
var headers$1={"plural-forms":"nplurals=2; plural=(n > 1);",language:"en_CA@ashkenazi"};var contexts$1={"":{Berachot:["Berachos"],Shabbat:["Shabbos"],Taanit:["Taanis"],Yevamot:["Yevamos"],Ketubot:["Kesubos"],"Baba Batra":["Baba Basra"],Makkot:["Makkos"],Shevuot:["Shevuos"],Horayot:["Horayos"],Menachot:["Menachos"],Bechorot:["Bechoros"],Keritot:["Kerisos"],Midot:["Midos"],"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"],Tazria:["Sazria"],"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"],Berakhot:["Berakhos"],Sheviit:["Sheviis"],Terumot:["Terumos"],Maasrot:["Maasros"],Eduyot:["Eduyos"],Avot:["Avos"],Bekhorot:["Bekhoros"],Middot:["Middos"],Oholot:["Oholos"],Tahorot:["Tahoros"],Mikvaot:["Mikvaos"]}};var poAshkenazi = {headers:headers$1,contexts:contexts$1};
|
|
5618
|
+
var headers$1={"plural-forms":"nplurals=2; plural=(n > 1);",language:"en_CA@ashkenazi"};var contexts$1={"":{Berachot:["Berachos"],Shabbat:["Shabbos"],Taanit:["Taanis"],Yevamot:["Yevamos"],Ketubot:["Kesubos"],"Baba Batra":["Baba Basra"],Makkot:["Makkos"],Shevuot:["Shevuos"],Horayot:["Horayos"],Menachot:["Menachos"],Bechorot:["Bechoros"],Keritot:["Kerisos"],Midot:["Midos"],"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"],Tazria:["Sazria"],"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"],Berakhot:["Berakhos"],Sheviit:["Sheviis"],Terumot:["Terumos"],Maasrot:["Maasros"],Eduyot:["Eduyos"],Avot:["Avos"],Bekhorot:["Bekhoros"],Middot:["Middos"],Oholot:["Oholos"],Tahorot:["Tahoros"],Mikvaot:["Mikvaos"],"Alot HaShachar":["Alos HaShachar"],Misheyakir:["Misheyakir"],"Kriat Shema, sof zeman":["Krias Shema, sof zman"],"Tefilah, sof zeman":["Tefilah, sof zman"],"Chatzot hayom":["Chatzos"],"Tzait HaKochavim":["Tzeis HaKochavim"]}};var poAshkenazi = {headers:headers$1,contexts:contexts$1};
|
|
5601
5619
|
|
|
5602
5620
|
Locale.addLocale('ashkenazi', poAshkenazi);
|
|
5603
5621
|
Locale.addLocale('a', poAshkenazi);
|
|
@@ -5923,6 +5941,7 @@ function getMaskFromOptions(options) {
|
|
|
5923
5941
|
if (m & OMER_COUNT) options.omer = true;
|
|
5924
5942
|
if (m & SHABBAT_MEVARCHIM) options.shabbatMevarchim = true;
|
|
5925
5943
|
if (m & flags.MISHNA_YOMI) options.mishnaYomi = true;
|
|
5944
|
+
if (m & flags.YOM_KIPPUR_KATAN) options.yomKippurKatan = true;
|
|
5926
5945
|
options.userMask = true;
|
|
5927
5946
|
return m;
|
|
5928
5947
|
}
|
|
@@ -5983,6 +6002,10 @@ function getMaskFromOptions(options) {
|
|
|
5983
6002
|
mask |= SHABBAT_MEVARCHIM;
|
|
5984
6003
|
}
|
|
5985
6004
|
|
|
6005
|
+
if (options.yomKippurKatan) {
|
|
6006
|
+
mask |= flags.YOM_KIPPUR_KATAN;
|
|
6007
|
+
}
|
|
6008
|
+
|
|
5986
6009
|
return mask;
|
|
5987
6010
|
}
|
|
5988
6011
|
|
|
@@ -6065,6 +6088,7 @@ class HebrewCalendar {
|
|
|
6065
6088
|
* * Mishna Yomi (`options.mishnaYomi`)
|
|
6066
6089
|
* * Shabbat Mevarchim HaChodesh on Saturday before Rosh Chodesh (`options.shabbatMevarchim`)
|
|
6067
6090
|
* * Molad announcement on Saturday before Rosh Chodesh (`options.molad`)
|
|
6091
|
+
* * Yom Kippur Katan (`options.yomKippurKatan`)
|
|
6068
6092
|
*
|
|
6069
6093
|
* Candle-lighting and Havdalah times are approximated using latitude and longitude
|
|
6070
6094
|
* specified by the {@link Location} class. The `Location` class contains a small
|
|
@@ -6477,11 +6501,12 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
|
|
|
6477
6501
|
return candlesEv; // holiday isn't observed here; bail out early
|
|
6478
6502
|
}
|
|
6479
6503
|
|
|
6480
|
-
|
|
6504
|
+
const eFlags = ev.getFlags();
|
|
6505
|
+
|
|
6506
|
+
if (!options.yomKippurKatan && eFlags & flags.YOM_KIPPUR_KATAN) {
|
|
6481
6507
|
return candlesEv; // bail out early
|
|
6482
6508
|
}
|
|
6483
6509
|
|
|
6484
|
-
const eFlags = ev.getFlags();
|
|
6485
6510
|
const location = options.location;
|
|
6486
6511
|
const isMajorFast = Boolean(eFlags & MAJOR_FAST);
|
|
6487
6512
|
const isMinorFast = Boolean(eFlags & MINOR_FAST);
|
|
@@ -6515,7 +6540,9 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
|
|
|
6515
6540
|
}
|
|
6516
6541
|
}
|
|
6517
6542
|
|
|
6518
|
-
if (
|
|
6543
|
+
if (options.yomKippurKatan && eFlags & flags.YOM_KIPPUR_KATAN) {
|
|
6544
|
+
events.push(ev);
|
|
6545
|
+
} else if (!options.noHolidays) {
|
|
6519
6546
|
events.push(ev); // the original event itself
|
|
6520
6547
|
}
|
|
6521
6548
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v3.41.
|
|
1
|
+
/*! @hebcal/core v3.41.3 */
|
|
2
2
|
/*
|
|
3
3
|
* More minimal greg routines
|
|
4
4
|
*/
|
|
@@ -62,32 +62,11 @@ function daysInMonth$1(month, year) {
|
|
|
62
62
|
function isDate(obj) {
|
|
63
63
|
return typeof obj === 'object' && Date.prototype === obj.__proto__;
|
|
64
64
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
* @return {number}
|
|
70
|
-
*/
|
|
71
|
-
|
|
72
|
-
function dayOfYear(date) {
|
|
73
|
-
if (!isDate(date)) {
|
|
74
|
-
throw new TypeError(`Argument not a Date: ${date}`);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const month = date.getMonth();
|
|
78
|
-
let doy = date.getDate() + 31 * month;
|
|
79
|
-
|
|
80
|
-
if (month > 1) {
|
|
81
|
-
// FEB
|
|
82
|
-
doy -= Math.floor((4 * (month + 1) + 23) / 10);
|
|
83
|
-
|
|
84
|
-
if (isLeapYear$1(date.getFullYear())) {
|
|
85
|
-
doy++;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
65
|
+
/*
|
|
66
|
+
const ABS_14SEP1752 = 639797;
|
|
67
|
+
const ABS_2SEP1752 = 639785;
|
|
68
|
+
*/
|
|
88
69
|
|
|
89
|
-
return doy;
|
|
90
|
-
}
|
|
91
70
|
/**
|
|
92
71
|
* Converts Gregorian date to absolute R.D. (Rata Die) days
|
|
93
72
|
* @private
|
|
@@ -100,12 +79,14 @@ function greg2abs(date) {
|
|
|
100
79
|
throw new TypeError(`Argument not a Date: ${date}`);
|
|
101
80
|
}
|
|
102
81
|
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
82
|
+
const abs = toFixed(date.getFullYear(), date.getMonth() + 1, date.getDate());
|
|
83
|
+
/*
|
|
84
|
+
if (abs < ABS_14SEP1752 && abs > ABS_2SEP1752) {
|
|
85
|
+
throw new RangeError(`Invalid Date: ${date}`);
|
|
86
|
+
}
|
|
87
|
+
*/
|
|
88
|
+
|
|
89
|
+
return abs;
|
|
109
90
|
}
|
|
110
91
|
/**
|
|
111
92
|
* @private
|
|
@@ -128,8 +109,8 @@ function yearFromFixed(abs) {
|
|
|
128
109
|
/**
|
|
129
110
|
* @private
|
|
130
111
|
* @param {number} year
|
|
131
|
-
* @param {number} month
|
|
132
|
-
* @param {number} day
|
|
112
|
+
* @param {number} month (1-12)
|
|
113
|
+
* @param {number} day (1-31)
|
|
133
114
|
* @return {number}
|
|
134
115
|
*/
|
|
135
116
|
|
|
@@ -156,6 +137,12 @@ function abs2greg(abs) {
|
|
|
156
137
|
}
|
|
157
138
|
|
|
158
139
|
abs = Math.trunc(abs);
|
|
140
|
+
/*
|
|
141
|
+
if (abs < ABS_14SEP1752 && abs > ABS_2SEP1752) {
|
|
142
|
+
throw new RangeError(`Invalid Date: ${abs}`);
|
|
143
|
+
}
|
|
144
|
+
*/
|
|
145
|
+
|
|
159
146
|
const year = yearFromFixed(abs);
|
|
160
147
|
const priorDays = abs - toFixed(year, 1, 1);
|
|
161
148
|
const correction = abs < toFixed(year, 3, 1) ? 0 : isLeapYear$1(year) ? 1 : 2;
|
|
@@ -233,13 +220,30 @@ class greg {
|
|
|
233
220
|
}
|
|
234
221
|
/**
|
|
235
222
|
* Returns number of days since January 1 of that year
|
|
223
|
+
* @deprecated
|
|
236
224
|
* @param {Date} date Gregorian date
|
|
237
225
|
* @return {number}
|
|
238
226
|
*/
|
|
239
227
|
|
|
240
228
|
|
|
241
229
|
static dayOfYear(date) {
|
|
242
|
-
|
|
230
|
+
if (!isDate(date)) {
|
|
231
|
+
throw new TypeError(`Argument not a Date: ${date}`);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
const month = date.getMonth();
|
|
235
|
+
let doy = date.getDate() + 31 * month;
|
|
236
|
+
|
|
237
|
+
if (month > 1) {
|
|
238
|
+
// FEB
|
|
239
|
+
doy -= Math.floor((4 * (month + 1) + 23) / 10);
|
|
240
|
+
|
|
241
|
+
if (isLeapYear$1(date.getFullYear())) {
|
|
242
|
+
doy++;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
return doy;
|
|
243
247
|
}
|
|
244
248
|
/**
|
|
245
249
|
* Converts Gregorian date to absolute R.D. (Rata Die) days
|
|
@@ -1926,7 +1930,10 @@ const flags = {
|
|
|
1926
1930
|
CHOL_HAMOED: 0x200000,
|
|
1927
1931
|
|
|
1928
1932
|
/** Mishna Yomi */
|
|
1929
|
-
MISHNA_YOMI: 0x400000
|
|
1933
|
+
MISHNA_YOMI: 0x400000,
|
|
1934
|
+
|
|
1935
|
+
/** Yom Kippur Katan, minor day of atonement on the day preceeding each Rosh Chodesh */
|
|
1936
|
+
YOM_KIPPUR_KATAN: 0x800000
|
|
1930
1937
|
};
|
|
1931
1938
|
/** Represents an Event with a title, date, and flags */
|
|
1932
1939
|
|
|
@@ -3347,6 +3354,7 @@ class Location {
|
|
|
3347
3354
|
}
|
|
3348
3355
|
/**
|
|
3349
3356
|
* Builds a city description from geonameid string components
|
|
3357
|
+
* @deprecated
|
|
3350
3358
|
* @param {string} cityName e.g. 'Tel Aviv' or 'Chicago'
|
|
3351
3359
|
* @param {string} admin1 e.g. 'England' or 'Massachusetts'
|
|
3352
3360
|
* @param {string} countryName full country name, e.g. 'Israel' or 'United States'
|
|
@@ -4829,6 +4837,12 @@ class MevarchimChodeshEvent extends Event {
|
|
|
4829
4837
|
const molad = new MoladEvent(date, hyear, monNext);
|
|
4830
4838
|
this.memo = molad.render();
|
|
4831
4839
|
}
|
|
4840
|
+
/** @return {string} */
|
|
4841
|
+
|
|
4842
|
+
|
|
4843
|
+
basename() {
|
|
4844
|
+
return this.getDesc();
|
|
4845
|
+
}
|
|
4832
4846
|
/**
|
|
4833
4847
|
* Returns (translated) description of this event
|
|
4834
4848
|
* @param {string} [locale] Optional locale name (defaults to active locale).
|
|
@@ -4878,10 +4892,16 @@ class YomKippurKatanEvent extends HolidayEvent {
|
|
|
4878
4892
|
* @param {string} nextMonthName name of the upcoming month
|
|
4879
4893
|
*/
|
|
4880
4894
|
constructor(date, nextMonthName) {
|
|
4881
|
-
super(date, `${ykk} ${nextMonthName}`, flags.MINOR_FAST);
|
|
4895
|
+
super(date, `${ykk} ${nextMonthName}`, flags.MINOR_FAST | flags.YOM_KIPPUR_KATAN);
|
|
4882
4896
|
this.nextMonthName = nextMonthName;
|
|
4883
4897
|
this.memo = `Minor Day of Atonement on the day preceeding Rosh Chodesh ${nextMonthName}`;
|
|
4884
4898
|
}
|
|
4899
|
+
/** @return {string} */
|
|
4900
|
+
|
|
4901
|
+
|
|
4902
|
+
basename() {
|
|
4903
|
+
return this.getDesc();
|
|
4904
|
+
}
|
|
4885
4905
|
/**
|
|
4886
4906
|
* @param {string} [locale] Optional locale name (defaults to active locale).
|
|
4887
4907
|
* @return {string}
|
|
@@ -4903,10 +4923,8 @@ class YomKippurKatanEvent extends HolidayEvent {
|
|
|
4903
4923
|
/** @return {string} */
|
|
4904
4924
|
|
|
4905
4925
|
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
const isoDate = isoDateTime.substring(0, isoDateTime.indexOf('T'));
|
|
4909
|
-
return isoDate.replace(/-/g, '');
|
|
4926
|
+
url() {
|
|
4927
|
+
return undefined;
|
|
4910
4928
|
}
|
|
4911
4929
|
|
|
4912
4930
|
}
|
|
@@ -5591,9 +5609,9 @@ function getBirthdayOrAnniversary_(hyear, gdate) {
|
|
|
5591
5609
|
return new HDate(day, month, hyear);
|
|
5592
5610
|
}
|
|
5593
5611
|
|
|
5594
|
-
const version="3.41.
|
|
5612
|
+
const version="3.41.3";
|
|
5595
5613
|
|
|
5596
|
-
const headers$1={"plural-forms":"nplurals=2; plural=(n > 1);",language:"en_CA@ashkenazi"};const contexts$1={"":{Berachot:["Berachos"],Shabbat:["Shabbos"],Taanit:["Taanis"],Yevamot:["Yevamos"],Ketubot:["Kesubos"],"Baba Batra":["Baba Basra"],Makkot:["Makkos"],Shevuot:["Shevuos"],Horayot:["Horayos"],Menachot:["Menachos"],Bechorot:["Bechoros"],Keritot:["Kerisos"],Midot:["Midos"],"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"],Tazria:["Sazria"],"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"],Berakhot:["Berakhos"],Sheviit:["Sheviis"],Terumot:["Terumos"],Maasrot:["Maasros"],Eduyot:["Eduyos"],Avot:["Avos"],Bekhorot:["Bekhoros"],Middot:["Middos"],Oholot:["Oholos"],Tahorot:["Tahoros"],Mikvaot:["Mikvaos"]}};var poAshkenazi = {headers:headers$1,contexts:contexts$1};
|
|
5614
|
+
const headers$1={"plural-forms":"nplurals=2; plural=(n > 1);",language:"en_CA@ashkenazi"};const contexts$1={"":{Berachot:["Berachos"],Shabbat:["Shabbos"],Taanit:["Taanis"],Yevamot:["Yevamos"],Ketubot:["Kesubos"],"Baba Batra":["Baba Basra"],Makkot:["Makkos"],Shevuot:["Shevuos"],Horayot:["Horayos"],Menachot:["Menachos"],Bechorot:["Bechoros"],Keritot:["Kerisos"],Midot:["Midos"],"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"],Tazria:["Sazria"],"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"],Berakhot:["Berakhos"],Sheviit:["Sheviis"],Terumot:["Terumos"],Maasrot:["Maasros"],Eduyot:["Eduyos"],Avot:["Avos"],Bekhorot:["Bekhoros"],Middot:["Middos"],Oholot:["Oholos"],Tahorot:["Tahoros"],Mikvaot:["Mikvaos"],"Alot HaShachar":["Alos HaShachar"],Misheyakir:["Misheyakir"],"Kriat Shema, sof zeman":["Krias Shema, sof zman"],"Tefilah, sof zeman":["Tefilah, sof zman"],"Chatzot hayom":["Chatzos"],"Tzait HaKochavim":["Tzeis HaKochavim"]}};var poAshkenazi = {headers:headers$1,contexts:contexts$1};
|
|
5597
5615
|
|
|
5598
5616
|
Locale.addLocale('ashkenazi', poAshkenazi);
|
|
5599
5617
|
Locale.addLocale('a', poAshkenazi);
|
|
@@ -5919,6 +5937,7 @@ function getMaskFromOptions(options) {
|
|
|
5919
5937
|
if (m & OMER_COUNT) options.omer = true;
|
|
5920
5938
|
if (m & SHABBAT_MEVARCHIM) options.shabbatMevarchim = true;
|
|
5921
5939
|
if (m & flags.MISHNA_YOMI) options.mishnaYomi = true;
|
|
5940
|
+
if (m & flags.YOM_KIPPUR_KATAN) options.yomKippurKatan = true;
|
|
5922
5941
|
options.userMask = true;
|
|
5923
5942
|
return m;
|
|
5924
5943
|
}
|
|
@@ -5979,6 +5998,10 @@ function getMaskFromOptions(options) {
|
|
|
5979
5998
|
mask |= SHABBAT_MEVARCHIM;
|
|
5980
5999
|
}
|
|
5981
6000
|
|
|
6001
|
+
if (options.yomKippurKatan) {
|
|
6002
|
+
mask |= flags.YOM_KIPPUR_KATAN;
|
|
6003
|
+
}
|
|
6004
|
+
|
|
5982
6005
|
return mask;
|
|
5983
6006
|
}
|
|
5984
6007
|
|
|
@@ -6061,6 +6084,7 @@ class HebrewCalendar {
|
|
|
6061
6084
|
* * Mishna Yomi (`options.mishnaYomi`)
|
|
6062
6085
|
* * Shabbat Mevarchim HaChodesh on Saturday before Rosh Chodesh (`options.shabbatMevarchim`)
|
|
6063
6086
|
* * Molad announcement on Saturday before Rosh Chodesh (`options.molad`)
|
|
6087
|
+
* * Yom Kippur Katan (`options.yomKippurKatan`)
|
|
6064
6088
|
*
|
|
6065
6089
|
* Candle-lighting and Havdalah times are approximated using latitude and longitude
|
|
6066
6090
|
* specified by the {@link Location} class. The `Location` class contains a small
|
|
@@ -6473,11 +6497,12 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
|
|
|
6473
6497
|
return candlesEv; // holiday isn't observed here; bail out early
|
|
6474
6498
|
}
|
|
6475
6499
|
|
|
6476
|
-
|
|
6500
|
+
const eFlags = ev.getFlags();
|
|
6501
|
+
|
|
6502
|
+
if (!options.yomKippurKatan && eFlags & flags.YOM_KIPPUR_KATAN) {
|
|
6477
6503
|
return candlesEv; // bail out early
|
|
6478
6504
|
}
|
|
6479
6505
|
|
|
6480
|
-
const eFlags = ev.getFlags();
|
|
6481
6506
|
const location = options.location;
|
|
6482
6507
|
const isMajorFast = Boolean(eFlags & MAJOR_FAST);
|
|
6483
6508
|
const isMinorFast = Boolean(eFlags & MINOR_FAST);
|
|
@@ -6511,7 +6536,9 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
|
|
|
6511
6536
|
}
|
|
6512
6537
|
}
|
|
6513
6538
|
|
|
6514
|
-
if (
|
|
6539
|
+
if (options.yomKippurKatan && eFlags & flags.YOM_KIPPUR_KATAN) {
|
|
6540
|
+
events.push(ev);
|
|
6541
|
+
} else if (!options.noHolidays) {
|
|
6515
6542
|
events.push(ev); // the original event itself
|
|
6516
6543
|
}
|
|
6517
6544
|
}
|
package/hebcal.d.ts
CHANGED
|
@@ -292,6 +292,7 @@ declare module '@hebcal/core' {
|
|
|
292
292
|
tzeit(hdate: Date | HDate, angle?: number): Date;
|
|
293
293
|
/**
|
|
294
294
|
* Builds a city description from geonameid string components
|
|
295
|
+
* @deprecated
|
|
295
296
|
* @param cityName e.g. 'Tel Aviv' or 'Chicago'
|
|
296
297
|
* @param admin1 e.g. 'England' or 'Massachusetts'
|
|
297
298
|
* @param countryName full country name, e.g. 'Israel' or 'United States'
|
|
@@ -786,6 +787,7 @@ declare module '@hebcal/core' {
|
|
|
786
787
|
static daysInMonth(month: number, year: number): number;
|
|
787
788
|
/**
|
|
788
789
|
* Returns number of days since January 1 of that year
|
|
790
|
+
* @deprecated
|
|
789
791
|
* @param date - Gregorian date
|
|
790
792
|
*/
|
|
791
793
|
static dayOfYear(date: Date): number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hebcal/core",
|
|
3
|
-
"version": "3.41.
|
|
3
|
+
"version": "3.41.4",
|
|
4
4
|
"author": "Michael J. Radwin (https://github.com/mjradwin)",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Eyal Schachter (https://github.com/Scimonster)",
|
|
@@ -63,9 +63,9 @@
|
|
|
63
63
|
"verbose": true
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@babel/core": "^7.18.
|
|
67
|
-
"@babel/preset-env": "^7.18.
|
|
68
|
-
"@babel/register": "^7.
|
|
66
|
+
"@babel/core": "^7.18.6",
|
|
67
|
+
"@babel/preset-env": "^7.18.6",
|
|
68
|
+
"@babel/register": "^7.18.6",
|
|
69
69
|
"@hebcal/solar-calc": "^1.1.2",
|
|
70
70
|
"@rollup/plugin-babel": "^5.3.1",
|
|
71
71
|
"@rollup/plugin-commonjs": "^22.0.1",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
74
74
|
"ava": "^4.3.0",
|
|
75
75
|
"codecov": "^3.8.3",
|
|
76
|
-
"core-js": "^3.23.
|
|
76
|
+
"core-js": "^3.23.3",
|
|
77
77
|
"eslint": "^8.18.0",
|
|
78
78
|
"eslint-config-google": "^0.14.0",
|
|
79
79
|
"jsdoc": "^3.6.10",
|