@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/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v3.
|
|
1
|
+
/*! @hebcal/core v3.29.0 */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
@@ -341,10 +341,11 @@ const alias = {
|
|
|
341
341
|
};
|
|
342
342
|
/**
|
|
343
343
|
* A locale in Hebcal is used for translations/transliterations of
|
|
344
|
-
* holidays. `@hebcal/core` supports
|
|
344
|
+
* holidays. `@hebcal/core` supports four locales by default
|
|
345
345
|
* * `en` - default, Sephardic transliterations (e.g. "Shabbat")
|
|
346
346
|
* * `ashkenazi` - Ashkenazi transliterations (e.g. "Shabbos")
|
|
347
347
|
* * `he` - Hebrew (e.g. "שַׁבָּת")
|
|
348
|
+
* * `he-x-NoNikud` - Hebrew without nikud (e.g. "שבת")
|
|
348
349
|
* @namespace
|
|
349
350
|
*/
|
|
350
351
|
|
|
@@ -366,7 +367,8 @@ const Locale = {
|
|
|
366
367
|
* @return {string}
|
|
367
368
|
*/
|
|
368
369
|
lookupTranslation: function (id, locale) {
|
|
369
|
-
const
|
|
370
|
+
const locale0 = locale && locale.toLowerCase();
|
|
371
|
+
const loc = typeof locale == 'string' && this.locales[locale0] || this.activeLocale;
|
|
370
372
|
const array = loc[id];
|
|
371
373
|
|
|
372
374
|
if (array && array.length && array[0].length) {
|
|
@@ -399,7 +401,7 @@ const Locale = {
|
|
|
399
401
|
*/
|
|
400
402
|
addLocale: function (locale, data) {
|
|
401
403
|
if (typeof data.contexts !== 'object' || typeof data.contexts[''] !== 'object') {
|
|
402
|
-
throw new
|
|
404
|
+
throw new TypeError(`Locale '${locale}' invalid compact format`);
|
|
403
405
|
}
|
|
404
406
|
|
|
405
407
|
this.locales[locale.toLowerCase()] = data.contexts[''];
|
|
@@ -417,7 +419,7 @@ const Locale = {
|
|
|
417
419
|
const obj = this.locales[locale0];
|
|
418
420
|
|
|
419
421
|
if (!obj) {
|
|
420
|
-
throw new
|
|
422
|
+
throw new RangeError(`Locale '${locale}' not found`);
|
|
421
423
|
}
|
|
422
424
|
|
|
423
425
|
this.activeName = alias[locale0] || locale0;
|
|
@@ -439,16 +441,33 @@ const Locale = {
|
|
|
439
441
|
* @return {string}
|
|
440
442
|
*/
|
|
441
443
|
ordinal: function (n, locale) {
|
|
442
|
-
const
|
|
444
|
+
const locale1 = locale && locale.toLowerCase();
|
|
445
|
+
const locale0 = locale1 || this.activeName;
|
|
443
446
|
|
|
444
|
-
if (!locale0
|
|
447
|
+
if (!locale0) {
|
|
445
448
|
return this.getEnOrdinal(n);
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
switch (locale0) {
|
|
452
|
+
case 'en':
|
|
453
|
+
case 's':
|
|
454
|
+
case 'a':
|
|
455
|
+
case 'ashkenazi':
|
|
456
|
+
case 'ashkenazi_litvish':
|
|
457
|
+
case 'ashkenazi_poylish':
|
|
458
|
+
case 'ashkenazi_standard':
|
|
459
|
+
return this.getEnOrdinal(n);
|
|
460
|
+
|
|
461
|
+
case 'es':
|
|
462
|
+
return n + 'º';
|
|
463
|
+
|
|
464
|
+
case 'h':
|
|
465
|
+
case 'he':
|
|
466
|
+
case 'he-x-nonikud':
|
|
467
|
+
return String(n);
|
|
468
|
+
|
|
469
|
+
default:
|
|
470
|
+
return n + '.';
|
|
452
471
|
}
|
|
453
472
|
},
|
|
454
473
|
|
|
@@ -952,20 +971,9 @@ class HDate$1 {
|
|
|
952
971
|
render(locale = null, showYear = true) {
|
|
953
972
|
const locale0 = locale || Locale.getLocaleName();
|
|
954
973
|
const day = this.getDate();
|
|
955
|
-
const monthName = Locale.gettext(this.getMonthName(),
|
|
974
|
+
const monthName = Locale.gettext(this.getMonthName(), locale0);
|
|
956
975
|
const nth = Locale.ordinal(day, locale0);
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
if (locale0 === 'en' || locale0 === 's' || 'ashkenazi' == locale0.substring(0, 9)) {
|
|
960
|
-
dayOf = ' of';
|
|
961
|
-
} else {
|
|
962
|
-
const ofStr = Locale.lookupTranslation('of', locale0);
|
|
963
|
-
|
|
964
|
-
if (ofStr) {
|
|
965
|
-
dayOf = ' ' + ofStr;
|
|
966
|
-
}
|
|
967
|
-
}
|
|
968
|
-
|
|
976
|
+
const dayOf = HDate$1.getDayOfTranslation(locale0);
|
|
969
977
|
const dateStr = `${nth}${dayOf} ${monthName}`;
|
|
970
978
|
|
|
971
979
|
if (showYear) {
|
|
@@ -975,6 +983,34 @@ class HDate$1 {
|
|
|
975
983
|
return dateStr;
|
|
976
984
|
}
|
|
977
985
|
}
|
|
986
|
+
/**
|
|
987
|
+
* @private
|
|
988
|
+
* @param {string} locale
|
|
989
|
+
* @return {string}
|
|
990
|
+
*/
|
|
991
|
+
|
|
992
|
+
|
|
993
|
+
static getDayOfTranslation(locale) {
|
|
994
|
+
switch (locale) {
|
|
995
|
+
case 'en':
|
|
996
|
+
case 's':
|
|
997
|
+
case 'a':
|
|
998
|
+
case 'ashkenazi':
|
|
999
|
+
return ' of';
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
const ofStr = Locale.lookupTranslation('of', locale);
|
|
1003
|
+
|
|
1004
|
+
if (ofStr) {
|
|
1005
|
+
return ' ' + ofStr;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
if ('ashkenazi' === locale.substring(0, 9)) {
|
|
1009
|
+
return ' of';
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
return '';
|
|
1013
|
+
}
|
|
978
1014
|
/**
|
|
979
1015
|
* Renders this Hebrew date in Hebrew gematriya, regardless of locale.
|
|
980
1016
|
* @example
|
|
@@ -1863,9 +1899,22 @@ class HebrewDateEvent extends Event {
|
|
|
1863
1899
|
|
|
1864
1900
|
|
|
1865
1901
|
render(locale) {
|
|
1866
|
-
const
|
|
1902
|
+
const locale1 = locale && locale.toLowerCase();
|
|
1903
|
+
const locale0 = locale1 || Locale.getLocaleName();
|
|
1867
1904
|
const hd = this.getDate();
|
|
1868
|
-
|
|
1905
|
+
|
|
1906
|
+
switch (locale0) {
|
|
1907
|
+
case 'h':
|
|
1908
|
+
case 'he':
|
|
1909
|
+
case 'he-x-nonikud':
|
|
1910
|
+
const dd = hd.getDate();
|
|
1911
|
+
const mm = Locale.gettext(hd.getMonthName(), locale0);
|
|
1912
|
+
const yy = hd.getFullYear();
|
|
1913
|
+
return gematriya(dd) + ' ' + mm + ' ' + gematriya(yy);
|
|
1914
|
+
|
|
1915
|
+
default:
|
|
1916
|
+
return hd.render(locale0, true);
|
|
1917
|
+
}
|
|
1869
1918
|
}
|
|
1870
1919
|
/**
|
|
1871
1920
|
* @param {string} [locale] Optional locale name (defaults to active locale).
|
|
@@ -1881,20 +1930,25 @@ class HebrewDateEvent extends Event {
|
|
|
1881
1930
|
|
|
1882
1931
|
|
|
1883
1932
|
renderBrief(locale) {
|
|
1884
|
-
const
|
|
1933
|
+
const locale1 = locale && locale.toLowerCase();
|
|
1934
|
+
const locale0 = locale1 || Locale.getLocaleName();
|
|
1885
1935
|
const hd = this.getDate();
|
|
1886
1936
|
|
|
1887
1937
|
if (hd.getMonth() === months.TISHREI && hd.getDate() === 1) {
|
|
1888
1938
|
return this.render(locale0);
|
|
1889
1939
|
}
|
|
1890
1940
|
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1941
|
+
switch (locale0) {
|
|
1942
|
+
case 'h':
|
|
1943
|
+
case 'he':
|
|
1944
|
+
case 'he-x-nonikud':
|
|
1945
|
+
const dd = hd.getDate();
|
|
1946
|
+
const mm = Locale.gettext(hd.getMonthName(), locale0);
|
|
1947
|
+
return gematriya(dd) + ' ' + mm;
|
|
1894
1948
|
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1949
|
+
default:
|
|
1950
|
+
return hd.render(locale0, false);
|
|
1951
|
+
}
|
|
1898
1952
|
}
|
|
1899
1953
|
/**
|
|
1900
1954
|
* Helper function to render a Hebrew date
|
|
@@ -4537,9 +4591,9 @@ function getHolidaysForYear(year) {
|
|
|
4537
4591
|
*/
|
|
4538
4592
|
|
|
4539
4593
|
if (nisan27dt.getDay() == FRI$1) {
|
|
4540
|
-
nisan27dt =
|
|
4594
|
+
nisan27dt = new HDate$1(26, NISAN$1, year);
|
|
4541
4595
|
} else if (nisan27dt.getDay() == SUN) {
|
|
4542
|
-
nisan27dt =
|
|
4596
|
+
nisan27dt = new HDate$1(28, NISAN$1, year);
|
|
4543
4597
|
}
|
|
4544
4598
|
|
|
4545
4599
|
add(new HolidayEvent(nisan27dt, 'Yom HaShoah', MODERN_HOLIDAY$1));
|
|
@@ -4561,8 +4615,7 @@ function getHolidaysForYear(year) {
|
|
|
4561
4615
|
day = 4;
|
|
4562
4616
|
}
|
|
4563
4617
|
|
|
4564
|
-
|
|
4565
|
-
add(new HolidayEvent(tmpDate, 'Yom HaZikaron', MODERN_HOLIDAY$1, emojiIsraelFlag), new HolidayEvent(tmpDate.next(), 'Yom HaAtzma\'ut', MODERN_HOLIDAY$1, emojiIsraelFlag));
|
|
4618
|
+
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));
|
|
4566
4619
|
}
|
|
4567
4620
|
|
|
4568
4621
|
if (year >= 5727) {
|
|
@@ -4582,7 +4635,7 @@ function getHolidaysForYear(year) {
|
|
|
4582
4635
|
let tamuz17attrs;
|
|
4583
4636
|
|
|
4584
4637
|
if (tamuz17.getDay() == SAT$1) {
|
|
4585
|
-
tamuz17 =
|
|
4638
|
+
tamuz17 = new HDate$1(18, TAMUZ, year);
|
|
4586
4639
|
tamuz17attrs = {
|
|
4587
4640
|
observed: true
|
|
4588
4641
|
};
|
|
@@ -4601,7 +4654,8 @@ function getHolidaysForYear(year) {
|
|
|
4601
4654
|
av9title += ' (observed)';
|
|
4602
4655
|
}
|
|
4603
4656
|
|
|
4604
|
-
|
|
4657
|
+
const av9abs = av9dt.abs();
|
|
4658
|
+
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));
|
|
4605
4659
|
const monthsInYear = HDate$1.monthsInYear(year);
|
|
4606
4660
|
|
|
4607
4661
|
for (let month = 1; month <= monthsInYear; month++) {
|
|
@@ -4630,9 +4684,9 @@ function getHolidaysForYear(year) {
|
|
|
4630
4684
|
return h;
|
|
4631
4685
|
}
|
|
4632
4686
|
|
|
4633
|
-
var version="3.
|
|
4687
|
+
var version="3.29.0";
|
|
4634
4688
|
|
|
4635
|
-
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};
|
|
4689
|
+
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};
|
|
4636
4690
|
|
|
4637
4691
|
Locale.addLocale('ashkenazi', poAshkenazi);
|
|
4638
4692
|
Locale.addLocale('a', poAshkenazi);
|
|
@@ -4641,6 +4695,22 @@ var headers={"plural-forms":"nplurals=2; plural=(n > 1);",language:"he_IL"};var
|
|
|
4641
4695
|
|
|
4642
4696
|
Locale.addLocale('he', poHe);
|
|
4643
4697
|
Locale.addLocale('h', poHe);
|
|
4698
|
+
const heStrs = poHe.contexts[''];
|
|
4699
|
+
const heNoNikud = {};
|
|
4700
|
+
Object.keys(heStrs).forEach(key => {
|
|
4701
|
+
heNoNikud[key] = [Locale.hebrewStripNikkud(heStrs[key][0])];
|
|
4702
|
+
});
|
|
4703
|
+
const localeName = 'he-x-NoNikud';
|
|
4704
|
+
const poHeNoNikud = {
|
|
4705
|
+
headers: {
|
|
4706
|
+
'plural-forms': 'nplurals=2; plural=(n!=1);',
|
|
4707
|
+
'language': localeName
|
|
4708
|
+
},
|
|
4709
|
+
contexts: {
|
|
4710
|
+
'': heNoNikud
|
|
4711
|
+
}
|
|
4712
|
+
};
|
|
4713
|
+
Locale.addLocale(localeName, poHeNoNikud);
|
|
4644
4714
|
|
|
4645
4715
|
/*
|
|
4646
4716
|
Hebcal - A Jewish Calendar Generator
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v3.
|
|
1
|
+
/*! @hebcal/core v3.29.0 */
|
|
2
2
|
/*
|
|
3
3
|
Hebcal - A Jewish Calendar Generator
|
|
4
4
|
Copyright (c) 1994-2020 Danny Sadinoff
|
|
@@ -337,10 +337,11 @@ const alias = {
|
|
|
337
337
|
};
|
|
338
338
|
/**
|
|
339
339
|
* A locale in Hebcal is used for translations/transliterations of
|
|
340
|
-
* holidays. `@hebcal/core` supports
|
|
340
|
+
* holidays. `@hebcal/core` supports four locales by default
|
|
341
341
|
* * `en` - default, Sephardic transliterations (e.g. "Shabbat")
|
|
342
342
|
* * `ashkenazi` - Ashkenazi transliterations (e.g. "Shabbos")
|
|
343
343
|
* * `he` - Hebrew (e.g. "שַׁבָּת")
|
|
344
|
+
* * `he-x-NoNikud` - Hebrew without nikud (e.g. "שבת")
|
|
344
345
|
* @namespace
|
|
345
346
|
*/
|
|
346
347
|
|
|
@@ -362,7 +363,8 @@ const Locale = {
|
|
|
362
363
|
* @return {string}
|
|
363
364
|
*/
|
|
364
365
|
lookupTranslation: function (id, locale) {
|
|
365
|
-
const
|
|
366
|
+
const locale0 = locale && locale.toLowerCase();
|
|
367
|
+
const loc = typeof locale == 'string' && this.locales[locale0] || this.activeLocale;
|
|
366
368
|
const array = loc[id];
|
|
367
369
|
|
|
368
370
|
if (array && array.length && array[0].length) {
|
|
@@ -395,7 +397,7 @@ const Locale = {
|
|
|
395
397
|
*/
|
|
396
398
|
addLocale: function (locale, data) {
|
|
397
399
|
if (typeof data.contexts !== 'object' || typeof data.contexts[''] !== 'object') {
|
|
398
|
-
throw new
|
|
400
|
+
throw new TypeError(`Locale '${locale}' invalid compact format`);
|
|
399
401
|
}
|
|
400
402
|
|
|
401
403
|
this.locales[locale.toLowerCase()] = data.contexts[''];
|
|
@@ -413,7 +415,7 @@ const Locale = {
|
|
|
413
415
|
const obj = this.locales[locale0];
|
|
414
416
|
|
|
415
417
|
if (!obj) {
|
|
416
|
-
throw new
|
|
418
|
+
throw new RangeError(`Locale '${locale}' not found`);
|
|
417
419
|
}
|
|
418
420
|
|
|
419
421
|
this.activeName = alias[locale0] || locale0;
|
|
@@ -435,16 +437,33 @@ const Locale = {
|
|
|
435
437
|
* @return {string}
|
|
436
438
|
*/
|
|
437
439
|
ordinal: function (n, locale) {
|
|
438
|
-
const
|
|
440
|
+
const locale1 = locale && locale.toLowerCase();
|
|
441
|
+
const locale0 = locale1 || this.activeName;
|
|
439
442
|
|
|
440
|
-
if (!locale0
|
|
443
|
+
if (!locale0) {
|
|
441
444
|
return this.getEnOrdinal(n);
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
switch (locale0) {
|
|
448
|
+
case 'en':
|
|
449
|
+
case 's':
|
|
450
|
+
case 'a':
|
|
451
|
+
case 'ashkenazi':
|
|
452
|
+
case 'ashkenazi_litvish':
|
|
453
|
+
case 'ashkenazi_poylish':
|
|
454
|
+
case 'ashkenazi_standard':
|
|
455
|
+
return this.getEnOrdinal(n);
|
|
456
|
+
|
|
457
|
+
case 'es':
|
|
458
|
+
return n + 'º';
|
|
459
|
+
|
|
460
|
+
case 'h':
|
|
461
|
+
case 'he':
|
|
462
|
+
case 'he-x-nonikud':
|
|
463
|
+
return String(n);
|
|
464
|
+
|
|
465
|
+
default:
|
|
466
|
+
return n + '.';
|
|
448
467
|
}
|
|
449
468
|
},
|
|
450
469
|
|
|
@@ -948,20 +967,9 @@ class HDate$1 {
|
|
|
948
967
|
render(locale = null, showYear = true) {
|
|
949
968
|
const locale0 = locale || Locale.getLocaleName();
|
|
950
969
|
const day = this.getDate();
|
|
951
|
-
const monthName = Locale.gettext(this.getMonthName(),
|
|
970
|
+
const monthName = Locale.gettext(this.getMonthName(), locale0);
|
|
952
971
|
const nth = Locale.ordinal(day, locale0);
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
if (locale0 === 'en' || locale0 === 's' || 'ashkenazi' == locale0.substring(0, 9)) {
|
|
956
|
-
dayOf = ' of';
|
|
957
|
-
} else {
|
|
958
|
-
const ofStr = Locale.lookupTranslation('of', locale0);
|
|
959
|
-
|
|
960
|
-
if (ofStr) {
|
|
961
|
-
dayOf = ' ' + ofStr;
|
|
962
|
-
}
|
|
963
|
-
}
|
|
964
|
-
|
|
972
|
+
const dayOf = HDate$1.getDayOfTranslation(locale0);
|
|
965
973
|
const dateStr = `${nth}${dayOf} ${monthName}`;
|
|
966
974
|
|
|
967
975
|
if (showYear) {
|
|
@@ -971,6 +979,34 @@ class HDate$1 {
|
|
|
971
979
|
return dateStr;
|
|
972
980
|
}
|
|
973
981
|
}
|
|
982
|
+
/**
|
|
983
|
+
* @private
|
|
984
|
+
* @param {string} locale
|
|
985
|
+
* @return {string}
|
|
986
|
+
*/
|
|
987
|
+
|
|
988
|
+
|
|
989
|
+
static getDayOfTranslation(locale) {
|
|
990
|
+
switch (locale) {
|
|
991
|
+
case 'en':
|
|
992
|
+
case 's':
|
|
993
|
+
case 'a':
|
|
994
|
+
case 'ashkenazi':
|
|
995
|
+
return ' of';
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
const ofStr = Locale.lookupTranslation('of', locale);
|
|
999
|
+
|
|
1000
|
+
if (ofStr) {
|
|
1001
|
+
return ' ' + ofStr;
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
if ('ashkenazi' === locale.substring(0, 9)) {
|
|
1005
|
+
return ' of';
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
return '';
|
|
1009
|
+
}
|
|
974
1010
|
/**
|
|
975
1011
|
* Renders this Hebrew date in Hebrew gematriya, regardless of locale.
|
|
976
1012
|
* @example
|
|
@@ -1859,9 +1895,22 @@ class HebrewDateEvent extends Event {
|
|
|
1859
1895
|
|
|
1860
1896
|
|
|
1861
1897
|
render(locale) {
|
|
1862
|
-
const
|
|
1898
|
+
const locale1 = locale && locale.toLowerCase();
|
|
1899
|
+
const locale0 = locale1 || Locale.getLocaleName();
|
|
1863
1900
|
const hd = this.getDate();
|
|
1864
|
-
|
|
1901
|
+
|
|
1902
|
+
switch (locale0) {
|
|
1903
|
+
case 'h':
|
|
1904
|
+
case 'he':
|
|
1905
|
+
case 'he-x-nonikud':
|
|
1906
|
+
const dd = hd.getDate();
|
|
1907
|
+
const mm = Locale.gettext(hd.getMonthName(), locale0);
|
|
1908
|
+
const yy = hd.getFullYear();
|
|
1909
|
+
return gematriya(dd) + ' ' + mm + ' ' + gematriya(yy);
|
|
1910
|
+
|
|
1911
|
+
default:
|
|
1912
|
+
return hd.render(locale0, true);
|
|
1913
|
+
}
|
|
1865
1914
|
}
|
|
1866
1915
|
/**
|
|
1867
1916
|
* @param {string} [locale] Optional locale name (defaults to active locale).
|
|
@@ -1877,20 +1926,25 @@ class HebrewDateEvent extends Event {
|
|
|
1877
1926
|
|
|
1878
1927
|
|
|
1879
1928
|
renderBrief(locale) {
|
|
1880
|
-
const
|
|
1929
|
+
const locale1 = locale && locale.toLowerCase();
|
|
1930
|
+
const locale0 = locale1 || Locale.getLocaleName();
|
|
1881
1931
|
const hd = this.getDate();
|
|
1882
1932
|
|
|
1883
1933
|
if (hd.getMonth() === months.TISHREI && hd.getDate() === 1) {
|
|
1884
1934
|
return this.render(locale0);
|
|
1885
1935
|
}
|
|
1886
1936
|
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1937
|
+
switch (locale0) {
|
|
1938
|
+
case 'h':
|
|
1939
|
+
case 'he':
|
|
1940
|
+
case 'he-x-nonikud':
|
|
1941
|
+
const dd = hd.getDate();
|
|
1942
|
+
const mm = Locale.gettext(hd.getMonthName(), locale0);
|
|
1943
|
+
return gematriya(dd) + ' ' + mm;
|
|
1890
1944
|
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1945
|
+
default:
|
|
1946
|
+
return hd.render(locale0, false);
|
|
1947
|
+
}
|
|
1894
1948
|
}
|
|
1895
1949
|
/**
|
|
1896
1950
|
* Helper function to render a Hebrew date
|
|
@@ -4533,9 +4587,9 @@ function getHolidaysForYear(year) {
|
|
|
4533
4587
|
*/
|
|
4534
4588
|
|
|
4535
4589
|
if (nisan27dt.getDay() == FRI$1) {
|
|
4536
|
-
nisan27dt =
|
|
4590
|
+
nisan27dt = new HDate$1(26, NISAN$1, year);
|
|
4537
4591
|
} else if (nisan27dt.getDay() == SUN) {
|
|
4538
|
-
nisan27dt =
|
|
4592
|
+
nisan27dt = new HDate$1(28, NISAN$1, year);
|
|
4539
4593
|
}
|
|
4540
4594
|
|
|
4541
4595
|
add(new HolidayEvent(nisan27dt, 'Yom HaShoah', MODERN_HOLIDAY$1));
|
|
@@ -4557,8 +4611,7 @@ function getHolidaysForYear(year) {
|
|
|
4557
4611
|
day = 4;
|
|
4558
4612
|
}
|
|
4559
4613
|
|
|
4560
|
-
|
|
4561
|
-
add(new HolidayEvent(tmpDate, 'Yom HaZikaron', MODERN_HOLIDAY$1, emojiIsraelFlag), new HolidayEvent(tmpDate.next(), 'Yom HaAtzma\'ut', MODERN_HOLIDAY$1, emojiIsraelFlag));
|
|
4614
|
+
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));
|
|
4562
4615
|
}
|
|
4563
4616
|
|
|
4564
4617
|
if (year >= 5727) {
|
|
@@ -4578,7 +4631,7 @@ function getHolidaysForYear(year) {
|
|
|
4578
4631
|
let tamuz17attrs;
|
|
4579
4632
|
|
|
4580
4633
|
if (tamuz17.getDay() == SAT$1) {
|
|
4581
|
-
tamuz17 =
|
|
4634
|
+
tamuz17 = new HDate$1(18, TAMUZ, year);
|
|
4582
4635
|
tamuz17attrs = {
|
|
4583
4636
|
observed: true
|
|
4584
4637
|
};
|
|
@@ -4597,7 +4650,8 @@ function getHolidaysForYear(year) {
|
|
|
4597
4650
|
av9title += ' (observed)';
|
|
4598
4651
|
}
|
|
4599
4652
|
|
|
4600
|
-
|
|
4653
|
+
const av9abs = av9dt.abs();
|
|
4654
|
+
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));
|
|
4601
4655
|
const monthsInYear = HDate$1.monthsInYear(year);
|
|
4602
4656
|
|
|
4603
4657
|
for (let month = 1; month <= monthsInYear; month++) {
|
|
@@ -4626,9 +4680,9 @@ function getHolidaysForYear(year) {
|
|
|
4626
4680
|
return h;
|
|
4627
4681
|
}
|
|
4628
4682
|
|
|
4629
|
-
var version="3.
|
|
4683
|
+
var version="3.29.0";
|
|
4630
4684
|
|
|
4631
|
-
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};
|
|
4685
|
+
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};
|
|
4632
4686
|
|
|
4633
4687
|
Locale.addLocale('ashkenazi', poAshkenazi);
|
|
4634
4688
|
Locale.addLocale('a', poAshkenazi);
|
|
@@ -4637,6 +4691,22 @@ var headers={"plural-forms":"nplurals=2; plural=(n > 1);",language:"he_IL"};var
|
|
|
4637
4691
|
|
|
4638
4692
|
Locale.addLocale('he', poHe);
|
|
4639
4693
|
Locale.addLocale('h', poHe);
|
|
4694
|
+
const heStrs = poHe.contexts[''];
|
|
4695
|
+
const heNoNikud = {};
|
|
4696
|
+
Object.keys(heStrs).forEach(key => {
|
|
4697
|
+
heNoNikud[key] = [Locale.hebrewStripNikkud(heStrs[key][0])];
|
|
4698
|
+
});
|
|
4699
|
+
const localeName = 'he-x-NoNikud';
|
|
4700
|
+
const poHeNoNikud = {
|
|
4701
|
+
headers: {
|
|
4702
|
+
'plural-forms': 'nplurals=2; plural=(n!=1);',
|
|
4703
|
+
'language': localeName
|
|
4704
|
+
},
|
|
4705
|
+
contexts: {
|
|
4706
|
+
'': heNoNikud
|
|
4707
|
+
}
|
|
4708
|
+
};
|
|
4709
|
+
Locale.addLocale(localeName, poHeNoNikud);
|
|
4640
4710
|
|
|
4641
4711
|
/*
|
|
4642
4712
|
Hebcal - A Jewish Calendar Generator
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hebcal/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.29.1",
|
|
4
4
|
"author": "Michael J. Radwin (https://github.com/mjradwin)",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Eyal Schachter (https://github.com/Scimonster)",
|
|
@@ -70,22 +70,22 @@
|
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@ava/babel": "^2.0.0",
|
|
73
|
-
"@babel/core": "^7.
|
|
74
|
-
"@babel/preset-env": "^7.
|
|
75
|
-
"@babel/register": "^7.
|
|
73
|
+
"@babel/core": "^7.16.0",
|
|
74
|
+
"@babel/preset-env": "^7.16.0",
|
|
75
|
+
"@babel/register": "^7.16.0",
|
|
76
76
|
"@hebcal/solar-calc": "^1.0.6",
|
|
77
77
|
"@rollup/plugin-babel": "^5.3.0",
|
|
78
78
|
"@rollup/plugin-commonjs": "^21.0.1",
|
|
79
79
|
"@rollup/plugin-json": "^4.1.0",
|
|
80
80
|
"@rollup/plugin-node-resolve": "^13.0.6",
|
|
81
81
|
"ava": "^3.15.0",
|
|
82
|
-
"core-js": "^3.19.
|
|
83
|
-
"eslint": "^8.
|
|
82
|
+
"core-js": "^3.19.1",
|
|
83
|
+
"eslint": "^8.2.0",
|
|
84
84
|
"eslint-config-google": "^0.14.0",
|
|
85
85
|
"jsdoc": "^3.6.7",
|
|
86
86
|
"jsdoc-to-markdown": "^7.1.0",
|
|
87
87
|
"nyc": "^15.1.0",
|
|
88
|
-
"rollup": "^2.
|
|
88
|
+
"rollup": "^2.59.0",
|
|
89
89
|
"rollup-plugin-terser": "^7.0.2",
|
|
90
90
|
"tsd-jsdoc": "^2.5.0",
|
|
91
91
|
"ttag-cli": "^1.9.3"
|