@hebcal/core 3.27.0 → 3.29.1
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 +77 -59
- package/dist/bundle.js +114 -44
- package/dist/bundle.min.js +2 -2
- package/dist/hdate-bundle.js +64 -28
- package/dist/hdate-bundle.min.js +2 -2
- package/dist/hdate.js +63 -27
- package/dist/hdate.mjs +63 -27
- package/dist/index.js +113 -43
- package/dist/index.mjs +113 -43
- package/package.json +7 -7
package/dist/bundle.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v3.
|
|
1
|
+
/*! @hebcal/core v3.29.0 */
|
|
2
2
|
var hebcal = (function (exports) {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -487,7 +487,7 @@ var store$2 = sharedStore;
|
|
|
487
487
|
(shared$3.exports = function (key, value) {
|
|
488
488
|
return store$2[key] || (store$2[key] = value !== undefined ? value : {});
|
|
489
489
|
})('versions', []).push({
|
|
490
|
-
version: '3.19.
|
|
490
|
+
version: '3.19.1',
|
|
491
491
|
mode: 'global',
|
|
492
492
|
copyright: '© 2021 Denis Pushkarev (zloirock.ru)'
|
|
493
493
|
});
|
|
@@ -1357,10 +1357,11 @@ const alias = {
|
|
|
1357
1357
|
};
|
|
1358
1358
|
/**
|
|
1359
1359
|
* A locale in Hebcal is used for translations/transliterations of
|
|
1360
|
-
* holidays. `@hebcal/core` supports
|
|
1360
|
+
* holidays. `@hebcal/core` supports four locales by default
|
|
1361
1361
|
* * `en` - default, Sephardic transliterations (e.g. "Shabbat")
|
|
1362
1362
|
* * `ashkenazi` - Ashkenazi transliterations (e.g. "Shabbos")
|
|
1363
1363
|
* * `he` - Hebrew (e.g. "שַׁבָּת")
|
|
1364
|
+
* * `he-x-NoNikud` - Hebrew without nikud (e.g. "שבת")
|
|
1364
1365
|
* @namespace
|
|
1365
1366
|
*/
|
|
1366
1367
|
|
|
@@ -1382,7 +1383,8 @@ const Locale = {
|
|
|
1382
1383
|
* @return {string}
|
|
1383
1384
|
*/
|
|
1384
1385
|
lookupTranslation: function lookupTranslation(id, locale) {
|
|
1385
|
-
const
|
|
1386
|
+
const locale0 = locale && locale.toLowerCase();
|
|
1387
|
+
const loc = typeof locale == 'string' && this.locales[locale0] || this.activeLocale;
|
|
1386
1388
|
const array = loc[id];
|
|
1387
1389
|
|
|
1388
1390
|
if (array && array.length && array[0].length) {
|
|
@@ -1415,7 +1417,7 @@ const Locale = {
|
|
|
1415
1417
|
*/
|
|
1416
1418
|
addLocale: function addLocale(locale, data) {
|
|
1417
1419
|
if (typeof data.contexts !== 'object' || typeof data.contexts[''] !== 'object') {
|
|
1418
|
-
throw new
|
|
1420
|
+
throw new TypeError("Locale '".concat(locale, "' invalid compact format"));
|
|
1419
1421
|
}
|
|
1420
1422
|
|
|
1421
1423
|
this.locales[locale.toLowerCase()] = data.contexts[''];
|
|
@@ -1433,7 +1435,7 @@ const Locale = {
|
|
|
1433
1435
|
const obj = this.locales[locale0];
|
|
1434
1436
|
|
|
1435
1437
|
if (!obj) {
|
|
1436
|
-
throw new
|
|
1438
|
+
throw new RangeError("Locale '".concat(locale, "' not found"));
|
|
1437
1439
|
}
|
|
1438
1440
|
|
|
1439
1441
|
this.activeName = alias[locale0] || locale0;
|
|
@@ -1455,16 +1457,33 @@ const Locale = {
|
|
|
1455
1457
|
* @return {string}
|
|
1456
1458
|
*/
|
|
1457
1459
|
ordinal: function ordinal(n, locale) {
|
|
1458
|
-
const
|
|
1460
|
+
const locale1 = locale && locale.toLowerCase();
|
|
1461
|
+
const locale0 = locale1 || this.activeName;
|
|
1459
1462
|
|
|
1460
|
-
if (!locale0
|
|
1463
|
+
if (!locale0) {
|
|
1461
1464
|
return this.getEnOrdinal(n);
|
|
1462
|
-
}
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1467
|
+
switch (locale0) {
|
|
1468
|
+
case 'en':
|
|
1469
|
+
case 's':
|
|
1470
|
+
case 'a':
|
|
1471
|
+
case 'ashkenazi':
|
|
1472
|
+
case 'ashkenazi_litvish':
|
|
1473
|
+
case 'ashkenazi_poylish':
|
|
1474
|
+
case 'ashkenazi_standard':
|
|
1475
|
+
return this.getEnOrdinal(n);
|
|
1476
|
+
|
|
1477
|
+
case 'es':
|
|
1478
|
+
return n + 'º';
|
|
1479
|
+
|
|
1480
|
+
case 'h':
|
|
1481
|
+
case 'he':
|
|
1482
|
+
case 'he-x-nonikud':
|
|
1483
|
+
return String(n);
|
|
1484
|
+
|
|
1485
|
+
default:
|
|
1486
|
+
return n + '.';
|
|
1468
1487
|
}
|
|
1469
1488
|
},
|
|
1470
1489
|
|
|
@@ -1950,20 +1969,9 @@ class HDate$1 {
|
|
|
1950
1969
|
let showYear = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
1951
1970
|
const locale0 = locale || Locale.getLocaleName();
|
|
1952
1971
|
const day = this.getDate();
|
|
1953
|
-
const monthName = Locale.gettext(this.getMonthName(),
|
|
1972
|
+
const monthName = Locale.gettext(this.getMonthName(), locale0);
|
|
1954
1973
|
const nth = Locale.ordinal(day, locale0);
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
if (locale0 === 'en' || locale0 === 's' || 'ashkenazi' == locale0.substring(0, 9)) {
|
|
1958
|
-
dayOf = ' of';
|
|
1959
|
-
} else {
|
|
1960
|
-
const ofStr = Locale.lookupTranslation('of', locale0);
|
|
1961
|
-
|
|
1962
|
-
if (ofStr) {
|
|
1963
|
-
dayOf = ' ' + ofStr;
|
|
1964
|
-
}
|
|
1965
|
-
}
|
|
1966
|
-
|
|
1974
|
+
const dayOf = HDate$1.getDayOfTranslation(locale0);
|
|
1967
1975
|
const dateStr = "".concat(nth).concat(dayOf, " ").concat(monthName);
|
|
1968
1976
|
|
|
1969
1977
|
if (showYear) {
|
|
@@ -1973,6 +1981,34 @@ class HDate$1 {
|
|
|
1973
1981
|
return dateStr;
|
|
1974
1982
|
}
|
|
1975
1983
|
}
|
|
1984
|
+
/**
|
|
1985
|
+
* @private
|
|
1986
|
+
* @param {string} locale
|
|
1987
|
+
* @return {string}
|
|
1988
|
+
*/
|
|
1989
|
+
|
|
1990
|
+
|
|
1991
|
+
static getDayOfTranslation(locale) {
|
|
1992
|
+
switch (locale) {
|
|
1993
|
+
case 'en':
|
|
1994
|
+
case 's':
|
|
1995
|
+
case 'a':
|
|
1996
|
+
case 'ashkenazi':
|
|
1997
|
+
return ' of';
|
|
1998
|
+
}
|
|
1999
|
+
|
|
2000
|
+
const ofStr = Locale.lookupTranslation('of', locale);
|
|
2001
|
+
|
|
2002
|
+
if (ofStr) {
|
|
2003
|
+
return ' ' + ofStr;
|
|
2004
|
+
}
|
|
2005
|
+
|
|
2006
|
+
if ('ashkenazi' === locale.substring(0, 9)) {
|
|
2007
|
+
return ' of';
|
|
2008
|
+
}
|
|
2009
|
+
|
|
2010
|
+
return '';
|
|
2011
|
+
}
|
|
1976
2012
|
/**
|
|
1977
2013
|
* Renders this Hebrew date in Hebrew gematriya, regardless of locale.
|
|
1978
2014
|
* @example
|
|
@@ -2863,9 +2899,22 @@ class HebrewDateEvent extends Event {
|
|
|
2863
2899
|
|
|
2864
2900
|
|
|
2865
2901
|
render(locale) {
|
|
2866
|
-
const
|
|
2902
|
+
const locale1 = locale && locale.toLowerCase();
|
|
2903
|
+
const locale0 = locale1 || Locale.getLocaleName();
|
|
2867
2904
|
const hd = this.getDate();
|
|
2868
|
-
|
|
2905
|
+
|
|
2906
|
+
switch (locale0) {
|
|
2907
|
+
case 'h':
|
|
2908
|
+
case 'he':
|
|
2909
|
+
case 'he-x-nonikud':
|
|
2910
|
+
const dd = hd.getDate();
|
|
2911
|
+
const mm = Locale.gettext(hd.getMonthName(), locale0);
|
|
2912
|
+
const yy = hd.getFullYear();
|
|
2913
|
+
return gematriya(dd) + ' ' + mm + ' ' + gematriya(yy);
|
|
2914
|
+
|
|
2915
|
+
default:
|
|
2916
|
+
return hd.render(locale0, true);
|
|
2917
|
+
}
|
|
2869
2918
|
}
|
|
2870
2919
|
/**
|
|
2871
2920
|
* @param {string} [locale] Optional locale name (defaults to active locale).
|
|
@@ -2881,20 +2930,25 @@ class HebrewDateEvent extends Event {
|
|
|
2881
2930
|
|
|
2882
2931
|
|
|
2883
2932
|
renderBrief(locale) {
|
|
2884
|
-
const
|
|
2933
|
+
const locale1 = locale && locale.toLowerCase();
|
|
2934
|
+
const locale0 = locale1 || Locale.getLocaleName();
|
|
2885
2935
|
const hd = this.getDate();
|
|
2886
2936
|
|
|
2887
2937
|
if (hd.getMonth() === months.TISHREI && hd.getDate() === 1) {
|
|
2888
2938
|
return this.render(locale0);
|
|
2889
2939
|
}
|
|
2890
2940
|
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2941
|
+
switch (locale0) {
|
|
2942
|
+
case 'h':
|
|
2943
|
+
case 'he':
|
|
2944
|
+
case 'he-x-nonikud':
|
|
2945
|
+
const dd = hd.getDate();
|
|
2946
|
+
const mm = Locale.gettext(hd.getMonthName(), locale0);
|
|
2947
|
+
return gematriya(dd) + ' ' + mm;
|
|
2894
2948
|
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2949
|
+
default:
|
|
2950
|
+
return hd.render(locale0, false);
|
|
2951
|
+
}
|
|
2898
2952
|
}
|
|
2899
2953
|
/**
|
|
2900
2954
|
* Helper function to render a Hebrew date
|
|
@@ -5542,9 +5596,9 @@ function getHolidaysForYear(year) {
|
|
|
5542
5596
|
*/
|
|
5543
5597
|
|
|
5544
5598
|
if (nisan27dt.getDay() == FRI$1) {
|
|
5545
|
-
nisan27dt =
|
|
5599
|
+
nisan27dt = new HDate$1(26, NISAN$1, year);
|
|
5546
5600
|
} else if (nisan27dt.getDay() == SUN) {
|
|
5547
|
-
nisan27dt =
|
|
5601
|
+
nisan27dt = new HDate$1(28, NISAN$1, year);
|
|
5548
5602
|
}
|
|
5549
5603
|
|
|
5550
5604
|
add(new HolidayEvent(nisan27dt, 'Yom HaShoah', MODERN_HOLIDAY$1));
|
|
@@ -5566,8 +5620,7 @@ function getHolidaysForYear(year) {
|
|
|
5566
5620
|
day = 4;
|
|
5567
5621
|
}
|
|
5568
5622
|
|
|
5569
|
-
|
|
5570
|
-
add(new HolidayEvent(tmpDate, 'Yom HaZikaron', MODERN_HOLIDAY$1, emojiIsraelFlag), new HolidayEvent(tmpDate.next(), 'Yom HaAtzma\'ut', MODERN_HOLIDAY$1, emojiIsraelFlag));
|
|
5623
|
+
add(new HolidayEvent(new HDate$1(day, IYYAR, year), 'Yom HaZikaron', MODERN_HOLIDAY$1, emojiIsraelFlag), new HolidayEvent(new HDate$1(day + 1, IYYAR, year), 'Yom HaAtzma\'ut', MODERN_HOLIDAY$1, emojiIsraelFlag));
|
|
5571
5624
|
}
|
|
5572
5625
|
|
|
5573
5626
|
if (year >= 5727) {
|
|
@@ -5587,7 +5640,7 @@ function getHolidaysForYear(year) {
|
|
|
5587
5640
|
let tamuz17attrs;
|
|
5588
5641
|
|
|
5589
5642
|
if (tamuz17.getDay() == SAT$1) {
|
|
5590
|
-
tamuz17 =
|
|
5643
|
+
tamuz17 = new HDate$1(18, TAMUZ, year);
|
|
5591
5644
|
tamuz17attrs = {
|
|
5592
5645
|
observed: true
|
|
5593
5646
|
};
|
|
@@ -5606,7 +5659,8 @@ function getHolidaysForYear(year) {
|
|
|
5606
5659
|
av9title += ' (observed)';
|
|
5607
5660
|
}
|
|
5608
5661
|
|
|
5609
|
-
|
|
5662
|
+
const av9abs = av9dt.abs();
|
|
5663
|
+
add(new HolidayEvent(new HDate$1(HDate$1.dayOnOrBefore(SAT$1, av9abs)), 'Shabbat Chazon', SPECIAL_SHABBAT$1), new HolidayEvent(av9dt.prev(), 'Erev Tish\'a B\'Av', EREV$1 | MAJOR_FAST$1, av9attrs), new HolidayEvent(av9dt, av9title, MAJOR_FAST$1, av9attrs), new HolidayEvent(new HDate$1(HDate$1.dayOnOrBefore(SAT$1, av9abs + 7)), 'Shabbat Nachamu', SPECIAL_SHABBAT$1));
|
|
5610
5664
|
const monthsInYear = HDate$1.monthsInYear(year);
|
|
5611
5665
|
|
|
5612
5666
|
for (let month = 1; month <= monthsInYear; month++) {
|
|
@@ -5635,9 +5689,9 @@ function getHolidaysForYear(year) {
|
|
|
5635
5689
|
return h;
|
|
5636
5690
|
}
|
|
5637
5691
|
|
|
5638
|
-
var version="3.
|
|
5692
|
+
var version="3.29.0";
|
|
5639
5693
|
|
|
5640
|
-
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"]}};var poAshkenazi = {headers:headers$1,contexts:contexts$1};
|
|
5694
|
+
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"]}};var poAshkenazi = {headers:headers$1,contexts:contexts$1};
|
|
5641
5695
|
|
|
5642
5696
|
Locale.addLocale('ashkenazi', poAshkenazi);
|
|
5643
5697
|
Locale.addLocale('a', poAshkenazi);
|
|
@@ -5646,6 +5700,22 @@ var headers={"plural-forms":"nplurals=2; plural=(n > 1);",language:"he_IL"};var
|
|
|
5646
5700
|
|
|
5647
5701
|
Locale.addLocale('he', poHe);
|
|
5648
5702
|
Locale.addLocale('h', poHe);
|
|
5703
|
+
const heStrs = poHe.contexts[''];
|
|
5704
|
+
const heNoNikud = {};
|
|
5705
|
+
Object.keys(heStrs).forEach(key => {
|
|
5706
|
+
heNoNikud[key] = [Locale.hebrewStripNikkud(heStrs[key][0])];
|
|
5707
|
+
});
|
|
5708
|
+
const localeName = 'he-x-NoNikud';
|
|
5709
|
+
const poHeNoNikud = {
|
|
5710
|
+
headers: {
|
|
5711
|
+
'plural-forms': 'nplurals=2; plural=(n!=1);',
|
|
5712
|
+
'language': localeName
|
|
5713
|
+
},
|
|
5714
|
+
contexts: {
|
|
5715
|
+
'': heNoNikud
|
|
5716
|
+
}
|
|
5717
|
+
};
|
|
5718
|
+
Locale.addLocale(localeName, poHeNoNikud);
|
|
5649
5719
|
|
|
5650
5720
|
const FRI = 5;
|
|
5651
5721
|
const SAT = 6;
|