@hebcal/rest-api 3.19.3 → 4.0.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 +1 -69
- package/dist/bundle.js +50 -112
- package/dist/bundle.min.js +2 -2
- package/dist/index.js +50 -110
- package/dist/index.mjs +50 -86
- package/package.json +6 -6
- package/rest-api.d.ts +3 -16
package/dist/index.js
CHANGED
|
@@ -1,30 +1,10 @@
|
|
|
1
|
-
/*! @hebcal/rest-api
|
|
1
|
+
/*! @hebcal/rest-api v4.0.0 */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
6
|
var core = require('@hebcal/core');
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
function _interopNamespace(e) {
|
|
10
|
-
if (e && e.__esModule) return e;
|
|
11
|
-
var n = Object.create(null);
|
|
12
|
-
if (e) {
|
|
13
|
-
Object.keys(e).forEach(function (k) {
|
|
14
|
-
if (k !== 'default') {
|
|
15
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
get: function () { return e[k]; }
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
n["default"] = e;
|
|
24
|
-
return Object.freeze(n);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
var leyn__namespace = /*#__PURE__*/_interopNamespace(leyn);
|
|
7
|
+
var leyning = require('@hebcal/leyning');
|
|
28
8
|
|
|
29
9
|
var Chanukah="Hanukkah, the Jewish festival of rededication. Also known as the Festival of Lights";var Pesach="Passover, the Feast of Unleavened Bread. Also called Chag HaMatzot (the Festival of Matzah), it commemorates the Exodus and freedom of the Israelites from ancient Egypt";var Purim="Celebration of Jewish deliverance as told by Megilat Esther. It commemorates a time when the Jewish people living in Persia were saved from extermination";var Shavuot="Festival of Weeks. Commemorates the giving of the Torah at Mount Sinai";var Sigd="Ethiopian Jewish holiday occurring 50 days after Yom Kippur";var Sukkot="Feast of Booths";var holidayDescription = {"Asara B'Tevet":"Fast commemorating the siege of Jerusalem",Chanukah:Chanukah,"Days of the Omer":"7 weeks from the second night of Pesach to the day before Shavuot","Lag BaOmer":"33rd day of counting the Omer","Leil Selichot":"Prayers for forgiveness in preparation for the High Holidays","Pesach Sheni":"Second Passover, one month after Passover",Pesach:Pesach,"Purim Katan":"Minor Purim celebration during Adar I on leap years",Purim:Purim,"Rosh Chodesh Nisan":"Start of month of Nisan on the Hebrew calendar. נִיסָן (transliterated Nisan or Nissan) is the 1st month of the Hebrew year, has 30 days, and corresponds to March or April on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Iyyar":"Start of month of Iyyar on the Hebrew calendar. אִיָיר (transliterated Iyyar or Iyar) is the 2nd month of the Hebrew year, has 29 days, and corresponds to April or May on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Sivan":"Start of month of Sivan on the Hebrew calendar. Sivan (סִיוָן) is the 3rd month of the Hebrew year, has 30 days, and corresponds to May or June on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Tamuz":"Start of month of Tamuz on the Hebrew calendar. תַּמּוּז (transliterated Tamuz or Tammuz) is the 4th month of the Hebrew year, has 29 days, and corresponds to June or July on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Av":"Start of month of Av on the Hebrew calendar. Av (אָב) is the 5th month of the Hebrew year, has 30 days, and corresponds to July or August on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Elul":"Start of month of Elul on the Hebrew calendar. Elul (אֱלוּל) is the 6th month of the Hebrew year, has 29 days, and corresponds to August or September on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Cheshvan":"Start of month of Cheshvan on the Hebrew calendar. חֶשְׁוָן (transliterated Cheshvan or Heshvan) is the 8th month of the Hebrew year, has 29 or 30 days, and corresponds to October or November on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Kislev":"Start of month of Kislev on the Hebrew calendar. Kislev (כִּסְלֵו) is the 9th month of the Hebrew year, has 30 or 29 days, and corresponds to November or December on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Tevet":"Start of month of Tevet on the Hebrew calendar. Tevet (טֵבֵת) is the 10th month of the Hebrew year, has 29 days, and corresponds to December or January on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Sh'vat":"Start of month of Sh'vat on the Hebrew calendar. שְׁבָט (transliterated Sh'vat or Shevat) is the 11th month of the Hebrew year, has 30 days, and corresponds to January or February on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Adar":"Start of month of Adar on the Hebrew calendar. Adar (אַדָר) is the 12th month of the Hebrew year, has 29 days, and corresponds to February or March on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Adar I":"Start of month of Adar I (on leap years) on the Hebrew calendar. Adar I (אַדָר א׳) is the 12th month of the Hebrew year, occurs only on leap years, has 30 days, and corresponds to February or March on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Adar II":"Start of month of Adar II (on leap years) on the Hebrew calendar. Adar II (אַדָר ב׳), sometimes \"Adar Bet\" or \"Adar Sheni\", is the 13th month of the Hebrew year, has 29 days, occurs only on leap years, and corresponds to February or March on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Hashana":"The Jewish New Year. Also spelled Rosh Hashanah","Rosh Hashana LaBehemot":"New Year for Tithing Animals","Shabbat Chazon":"Shabbat before Tish'a B'Av (Shabbat of Prophecy/Shabbat of Vision)","Shabbat HaChodesh":"Shabbat before Rosh Chodesh Nissan","Shabbat HaGadol":"Shabbat before Pesach","Shabbat Machar Chodesh":"When Shabbat falls the day before Rosh Chodesh","Shabbat Nachamu":"Shabbat after Tish'a B'Av (Shabbat of Consolation). The first of seven Shabbatot leading up to Rosh Hashanah. Named after the Haftarah (from Isaiah 40) which begins with the verse נַחֲמוּ נַחֲמוּ, עַמִּי (\"Comfort, oh comfort my people\")","Shabbat Parah":"Shabbat of the Red Heifer","Shabbat Rosh Chodesh":"When Shabbat falls on Rosh Chodesh","Shabbat Shekalim":"Shabbat before Rosh Chodesh Adar","Shabbat Shirah":"Shabbat of Song","Shabbat Shuva":"Shabbat that falls between Rosh Hashanah and Yom Kippur (Shabbat of Returning)","Shabbat Zachor":"Shabbat before Purim",Shavuot:Shavuot,"Shmini Atzeret":"Eighth Day of Assembly","Shushan Purim":"Purim celebrated in Jerusalem and walled cities",Sigd:Sigd,"Simchat Torah":"Day of Celebrating the Torah",Sukkot:Sukkot,"Ta'anit Bechorot":"Fast of the First Born","Ta'anit Esther":"Fast of Esther","Tish'a B'Av":"The Ninth of Av. Fast commemorating the destruction of the two Temples","Tu B'Av":"Minor Jewish holiday of love. Observed on the 15th day of the Hebrew month of Av","Tu BiShvat":"New Year for Trees","Tzom Gedaliah":"Fast of the Seventh Month. Commemorates the assassination of the Jewish governor of Judah","Tzom Tammuz":"Fast commemorating breaching of the walls of Jerusalem before the destruction of the Second Temple","Yom HaAliyah":"Recognizes Aliyah, immigration to the Jewish State of Israel","Yom HaAliyah School Observance":"Aliyah Day observed in Israeli schools","Yom HaAtzma'ut":"Israeli Independence Day. Commemorates the declaration of independence of Israel in 1948. Although Yom HaAtzma'ut is normally observed on the 5th of Iyyar, it may be moved earlier or postponed if observance of the holiday (or Yom HaZikaron, which always precedes it) would conflict with Shabbat","Yom HaShoah":"Holocaust Memorial Day","Yom HaZikaron":"Israeli Memorial Day. Remembers those who died in the War of Independence and other wars in Israel. The full name of the holiday is Yom HaZikaron LeHalalei Ma'arakhot Yisrael ul'Nifge'ei Pe'ulot HaEivah (Hebrew: יוֹם הזִּכָּרוֹן לְחַלְלֵי מַעֲרָכוֹת יִשְׂרָאֵל וּלְנִפְגְעֵי פְּעֻלּוֹת הָאֵיבָה), Memorial Day for the Fallen Soldiers of the Wars of Israel and Victims of Actions of Terrorism. Although Yom Hazikaron is normally observed on the 4th of Iyyar, it may be moved earlier or postponed if observance of the holiday (or Yom HaAtzma'ut, which always follows it) would conflict with Shabbat","Yom Kippur":"Day of Atonement","Yom Kippur Katan":"Minor day of atonement occurring monthly on the day preceeding each Rosh Chodesh","Yom Yerushalayim":"Jerusalem Day. Commemorates the re-unification of Jerusalem in 1967"};
|
|
30
10
|
|
|
@@ -76,17 +56,32 @@ function makeAnchor(s) {
|
|
|
76
56
|
*/
|
|
77
57
|
|
|
78
58
|
function getDownloadFilename(options) {
|
|
79
|
-
let fileName = '
|
|
59
|
+
let fileName = 'hebcal';
|
|
80
60
|
|
|
81
|
-
if (options.
|
|
82
|
-
fileName += '
|
|
83
|
-
}
|
|
61
|
+
if (options.year) {
|
|
62
|
+
fileName += '_' + options.year;
|
|
84
63
|
|
|
85
|
-
|
|
86
|
-
|
|
64
|
+
if (options.isHebrewYear) {
|
|
65
|
+
fileName += 'h';
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (options.month) {
|
|
69
|
+
fileName += '_' + options.month;
|
|
70
|
+
}
|
|
71
|
+
} else if (typeof options.start === 'object' && typeof options.end === 'object') {
|
|
72
|
+
const start = new core.HDate(options.start);
|
|
73
|
+
const end = new core.HDate(options.end);
|
|
74
|
+
const y1 = start.greg().getFullYear();
|
|
75
|
+
const y2 = end.greg().getFullYear();
|
|
76
|
+
|
|
77
|
+
if (y1 === y2) {
|
|
78
|
+
fileName += '_' + y1;
|
|
79
|
+
} else {
|
|
80
|
+
fileName += '_' + y1 + '_' + y2;
|
|
81
|
+
}
|
|
87
82
|
}
|
|
88
83
|
|
|
89
|
-
if (options.location) {
|
|
84
|
+
if (typeof options.location === 'object') {
|
|
90
85
|
const loc = options.location;
|
|
91
86
|
const name = loc.zip || loc.asciiname || loc.getShortName();
|
|
92
87
|
|
|
@@ -107,7 +102,7 @@ function pad2(number) {
|
|
|
107
102
|
return '0' + number;
|
|
108
103
|
}
|
|
109
104
|
|
|
110
|
-
return
|
|
105
|
+
return '' + number;
|
|
111
106
|
}
|
|
112
107
|
/**
|
|
113
108
|
* @param {number} number
|
|
@@ -125,18 +120,7 @@ function pad4(number) {
|
|
|
125
120
|
return '0' + number;
|
|
126
121
|
}
|
|
127
122
|
|
|
128
|
-
return
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Get offset string (like "+05:00" or "-08:00") from tzid (like "Europe/Moscow")
|
|
132
|
-
* @deprecated
|
|
133
|
-
* @param {string} tzid
|
|
134
|
-
* @param {Date} date
|
|
135
|
-
* @return {string}
|
|
136
|
-
*/
|
|
137
|
-
|
|
138
|
-
function timeZoneOffsetStr(tzid, date) {
|
|
139
|
-
return core.Zmanim.timeZoneOffset(tzid, date);
|
|
123
|
+
return '' + number;
|
|
140
124
|
}
|
|
141
125
|
/**
|
|
142
126
|
* Returns just the date portion as YYYY-MM-DD
|
|
@@ -147,20 +131,6 @@ function timeZoneOffsetStr(tzid, date) {
|
|
|
147
131
|
function toISOString(d) {
|
|
148
132
|
return pad4(d.getFullYear()) + '-' + pad2(d.getMonth() + 1) + '-' + pad2(d.getDate());
|
|
149
133
|
}
|
|
150
|
-
/**
|
|
151
|
-
* Returns a string like "2018-09-01T12:30:00-05:00"
|
|
152
|
-
* @deprecated
|
|
153
|
-
* @param {Date} date
|
|
154
|
-
* @param {string} timeStr must be formatted with only hours and minutes, like "17:12"
|
|
155
|
-
* @param {string} tzid like "America/New_York"
|
|
156
|
-
* @return {string}
|
|
157
|
-
*/
|
|
158
|
-
|
|
159
|
-
function toISOStringWithTimezone(date, timeStr, tzid) {
|
|
160
|
-
const str = toISOString(date);
|
|
161
|
-
if (!timeStr) return str;
|
|
162
|
-
return str + 'T' + timeStr + ':00' + core.Zmanim.timeZoneOffset(tzid, date);
|
|
163
|
-
}
|
|
164
134
|
/**
|
|
165
135
|
* Returns a category and subcategory name
|
|
166
136
|
* @param {Event} ev
|
|
@@ -341,7 +311,7 @@ function makeTorahMemoText(ev, il) {
|
|
|
341
311
|
return '';
|
|
342
312
|
}
|
|
343
313
|
|
|
344
|
-
const reading = mask & core.flags.PARSHA_HASHAVUA ?
|
|
314
|
+
const reading = mask & core.flags.PARSHA_HASHAVUA ? leyning.getLeyningForParshaHaShavua(ev, il) : leyning.getLeyningForHoliday(ev, il);
|
|
345
315
|
let memo = '';
|
|
346
316
|
|
|
347
317
|
if (reading && (reading.summary || reading.haftara)) {
|
|
@@ -596,7 +566,7 @@ function eventsToClassicApi(events, options, leyning = true) {
|
|
|
596
566
|
* @return {Object}
|
|
597
567
|
*/
|
|
598
568
|
|
|
599
|
-
function eventToClassicApiObject(ev, options, leyning = true) {
|
|
569
|
+
function eventToClassicApiObject(ev, options, leyning$1 = true) {
|
|
600
570
|
const timed = Boolean(ev.eventTime);
|
|
601
571
|
const hd = ev.getDate();
|
|
602
572
|
const dt = hd.greg();
|
|
@@ -643,20 +613,20 @@ function eventToClassicApiObject(ev, options, leyning = true) {
|
|
|
643
613
|
}
|
|
644
614
|
|
|
645
615
|
if (!candles) {
|
|
646
|
-
if (leyning) {
|
|
616
|
+
if (leyning$1) {
|
|
647
617
|
const il = options.il;
|
|
648
618
|
const isParsha = mask === core.flags.PARSHA_HASHAVUA;
|
|
649
|
-
const reading = isParsha ?
|
|
619
|
+
const reading = isParsha ? leyning.getLeyningForParshaHaShavua(ev, il) : leyning.getLeyningForHoliday(ev, il);
|
|
650
620
|
|
|
651
621
|
if (reading) {
|
|
652
622
|
result.leyning = formatLeyningResult(reading);
|
|
653
623
|
const hyear = hd.getFullYear();
|
|
654
624
|
|
|
655
|
-
if (isParsha && !il && hyear >= 5745
|
|
656
|
-
const triReading =
|
|
625
|
+
if (isParsha && !il && hyear >= 5745) {
|
|
626
|
+
const triReading = leyning.getTriennialForParshaHaShavua(ev);
|
|
657
627
|
|
|
658
628
|
if (triReading) {
|
|
659
|
-
result.leyning.triennial = formatAliyot({}, triReading);
|
|
629
|
+
result.leyning.triennial = formatAliyot({}, triReading.aliyot);
|
|
660
630
|
}
|
|
661
631
|
}
|
|
662
632
|
}
|
|
@@ -686,6 +656,17 @@ function eventToClassicApiObject(ev, options, leyning = true) {
|
|
|
686
656
|
};
|
|
687
657
|
}
|
|
688
658
|
|
|
659
|
+
if (mask & core.flags.HEBREW_DATE) {
|
|
660
|
+
const yy = hd.getFullYear();
|
|
661
|
+
const mm = hd.getMonthName();
|
|
662
|
+
const dd = hd.getDate();
|
|
663
|
+
result.heDateParts = {
|
|
664
|
+
y: core.gematriya(yy),
|
|
665
|
+
m: core.Locale.gettext(mm, 'he-x-NoNikud'),
|
|
666
|
+
d: core.gematriya(dd)
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
|
|
689
670
|
const memo = ev.memo || holidayDescription[ev.basename()];
|
|
690
671
|
|
|
691
672
|
if (memo) {
|
|
@@ -712,13 +693,13 @@ function formatAliyot(result, aliyot) {
|
|
|
712
693
|
|
|
713
694
|
if (typeof aliyah !== 'undefined') {
|
|
714
695
|
const k = num == 'M' ? 'maftir' : num;
|
|
715
|
-
result[k] =
|
|
696
|
+
result[k] = leyning.formatAliyahWithBook(aliyah);
|
|
716
697
|
}
|
|
717
698
|
});
|
|
718
699
|
return result;
|
|
719
700
|
}
|
|
720
701
|
/**
|
|
721
|
-
* @param {
|
|
702
|
+
* @param {Leyning} reading
|
|
722
703
|
* @return {Object}
|
|
723
704
|
*/
|
|
724
705
|
|
|
@@ -792,32 +773,7 @@ function getLinkAndGuid(ev, il, tzid, mainUrl, utmSource, utmMedium) {
|
|
|
792
773
|
|
|
793
774
|
return [link, guid];
|
|
794
775
|
}
|
|
795
|
-
/**
|
|
796
|
-
* @param {Event[]} events
|
|
797
|
-
* @param {Location} location
|
|
798
|
-
* @param {string} mainUrl
|
|
799
|
-
* @param {string} selfUrl
|
|
800
|
-
* @param {string} [lang] language such as 'he' (default 'en-US')
|
|
801
|
-
* @param {boolean} [evPubDate] if true, use event time as pubDate (false uses lastBuildDate)
|
|
802
|
-
* @return {string}
|
|
803
|
-
*/
|
|
804
776
|
|
|
805
|
-
|
|
806
|
-
function eventsToRss(events, location, mainUrl, selfUrl, lang = 'en-US', evPubDate = true) {
|
|
807
|
-
const cityDescr = location.getName();
|
|
808
|
-
const options = {
|
|
809
|
-
location,
|
|
810
|
-
mainUrl,
|
|
811
|
-
selfUrl,
|
|
812
|
-
lang,
|
|
813
|
-
evPubDate,
|
|
814
|
-
title: core.Locale.gettext('Shabbat') + ` Times for ${cityDescr}`,
|
|
815
|
-
description: `Weekly Shabbat candle lighting times for ${cityDescr}`,
|
|
816
|
-
utmSource: 'shabbat1c',
|
|
817
|
-
utmMedium: 'rss'
|
|
818
|
-
};
|
|
819
|
-
return eventsToRss2(events, options);
|
|
820
|
-
}
|
|
821
777
|
const localeToLg = {
|
|
822
778
|
's': 'en',
|
|
823
779
|
'a': 'en',
|
|
@@ -898,28 +854,15 @@ function getPubDate(ev, evPubDate, evDate, lastBuildDate) {
|
|
|
898
854
|
|
|
899
855
|
|
|
900
856
|
function eventToRssItem2(ev, options) {
|
|
901
|
-
return eventToRssItem(ev, options.evPubDate, options.lastBuildDate, options.dayFormat, options.location, options.mainUrl, options);
|
|
902
|
-
}
|
|
903
|
-
/**
|
|
904
|
-
* @param {Event} ev
|
|
905
|
-
* @param {boolean} evPubDate
|
|
906
|
-
* @param {string} lastBuildDate
|
|
907
|
-
* @param {Intl.DateTimeFormat} dayFormat
|
|
908
|
-
* @param {Location} location
|
|
909
|
-
* @param {string} mainUrl
|
|
910
|
-
* @param {CalOptions} [options]
|
|
911
|
-
* @return {string}
|
|
912
|
-
*/
|
|
913
|
-
|
|
914
|
-
function eventToRssItem(ev, evPubDate, lastBuildDate, dayFormat, location, mainUrl, options) {
|
|
915
857
|
let subj = ev.render();
|
|
916
858
|
const evDate = ev.getDate().greg();
|
|
917
|
-
const pubDate = getPubDate(ev, evPubDate, evDate, lastBuildDate);
|
|
859
|
+
const pubDate = getPubDate(ev, options.evPubDate, evDate, options.lastBuildDate);
|
|
860
|
+
const location = options.location;
|
|
918
861
|
const il = location ? location.getIsrael() : false;
|
|
919
862
|
const tzid = location ? location.getTzid() : 'UTC';
|
|
920
863
|
const utmSource = options && options.utmSource || 'shabbat1c';
|
|
921
864
|
const utmMedium = options && options.utmMedium || 'rss';
|
|
922
|
-
const linkGuid = getLinkAndGuid(ev, il, tzid, mainUrl, utmSource, utmMedium);
|
|
865
|
+
const linkGuid = getLinkAndGuid(ev, il, tzid, options.mainUrl, utmSource, utmMedium);
|
|
923
866
|
const link = linkGuid[0];
|
|
924
867
|
const guid = linkGuid[1];
|
|
925
868
|
const categories = getEventCategories(ev);
|
|
@@ -944,6 +887,7 @@ function eventToRssItem(ev, evPubDate, lastBuildDate, dayFormat, location, mainU
|
|
|
944
887
|
memo = ev.getFlags() & core.flags.PARSHA_HASHAVUA ? makeTorahMemoText(ev, il) : ev.memo || holidayDescription[ev.basename()];
|
|
945
888
|
}
|
|
946
889
|
|
|
890
|
+
const dayFormat = options.dayFormat;
|
|
947
891
|
const description = memo || dayFormat.format(evDate);
|
|
948
892
|
const geoTags = cat0 == 'candles' ? `<geo:lat>${location.getLatitude()}</geo:lat>\n<geo:long>${location.getLongitude()}</geo:long>\n` : '';
|
|
949
893
|
return `<item>
|
|
@@ -1015,11 +959,9 @@ exports.countryNames = countryNames;
|
|
|
1015
959
|
exports.eventToClassicApiObject = eventToClassicApiObject;
|
|
1016
960
|
exports.eventToCsv = eventToCsv;
|
|
1017
961
|
exports.eventToFullCalendar = eventToFullCalendar;
|
|
1018
|
-
exports.eventToRssItem = eventToRssItem;
|
|
1019
962
|
exports.eventToRssItem2 = eventToRssItem2;
|
|
1020
963
|
exports.eventsToClassicApi = eventsToClassicApi;
|
|
1021
964
|
exports.eventsToCsv = eventsToCsv;
|
|
1022
|
-
exports.eventsToRss = eventsToRss;
|
|
1023
965
|
exports.eventsToRss2 = eventsToRss2;
|
|
1024
966
|
exports.getCalendarTitle = getCalendarTitle;
|
|
1025
967
|
exports.getDownloadFilename = getDownloadFilename;
|
|
@@ -1033,6 +975,4 @@ exports.pad2 = pad2;
|
|
|
1033
975
|
exports.pad4 = pad4;
|
|
1034
976
|
exports.renderTitleWithoutTime = renderTitleWithoutTime;
|
|
1035
977
|
exports.shouldRenderBrief = shouldRenderBrief;
|
|
1036
|
-
exports.timeZoneOffsetStr = timeZoneOffsetStr;
|
|
1037
978
|
exports.toISOString = toISOString;
|
|
1038
|
-
exports.toISOStringWithTimezone = toISOStringWithTimezone;
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! @hebcal/rest-api
|
|
2
|
-
import { flags,
|
|
3
|
-
import
|
|
1
|
+
/*! @hebcal/rest-api v4.0.0 */
|
|
2
|
+
import { flags, HDate, HebrewCalendar, Zmanim, Locale, gematriya } from '@hebcal/core';
|
|
3
|
+
import { getLeyningForParshaHaShavua, getLeyningForHoliday, getTriennialForParshaHaShavua, formatAliyahWithBook } from '@hebcal/leyning';
|
|
4
4
|
|
|
5
5
|
const Chanukah="Hanukkah, the Jewish festival of rededication. Also known as the Festival of Lights";const Pesach="Passover, the Feast of Unleavened Bread. Also called Chag HaMatzot (the Festival of Matzah), it commemorates the Exodus and freedom of the Israelites from ancient Egypt";const Purim="Celebration of Jewish deliverance as told by Megilat Esther. It commemorates a time when the Jewish people living in Persia were saved from extermination";const Shavuot="Festival of Weeks. Commemorates the giving of the Torah at Mount Sinai";const Sigd="Ethiopian Jewish holiday occurring 50 days after Yom Kippur";const Sukkot="Feast of Booths";var holidayDescription = {"Asara B'Tevet":"Fast commemorating the siege of Jerusalem",Chanukah:Chanukah,"Days of the Omer":"7 weeks from the second night of Pesach to the day before Shavuot","Lag BaOmer":"33rd day of counting the Omer","Leil Selichot":"Prayers for forgiveness in preparation for the High Holidays","Pesach Sheni":"Second Passover, one month after Passover",Pesach:Pesach,"Purim Katan":"Minor Purim celebration during Adar I on leap years",Purim:Purim,"Rosh Chodesh Nisan":"Start of month of Nisan on the Hebrew calendar. נִיסָן (transliterated Nisan or Nissan) is the 1st month of the Hebrew year, has 30 days, and corresponds to March or April on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Iyyar":"Start of month of Iyyar on the Hebrew calendar. אִיָיר (transliterated Iyyar or Iyar) is the 2nd month of the Hebrew year, has 29 days, and corresponds to April or May on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Sivan":"Start of month of Sivan on the Hebrew calendar. Sivan (סִיוָן) is the 3rd month of the Hebrew year, has 30 days, and corresponds to May or June on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Tamuz":"Start of month of Tamuz on the Hebrew calendar. תַּמּוּז (transliterated Tamuz or Tammuz) is the 4th month of the Hebrew year, has 29 days, and corresponds to June or July on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Av":"Start of month of Av on the Hebrew calendar. Av (אָב) is the 5th month of the Hebrew year, has 30 days, and corresponds to July or August on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Elul":"Start of month of Elul on the Hebrew calendar. Elul (אֱלוּל) is the 6th month of the Hebrew year, has 29 days, and corresponds to August or September on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Cheshvan":"Start of month of Cheshvan on the Hebrew calendar. חֶשְׁוָן (transliterated Cheshvan or Heshvan) is the 8th month of the Hebrew year, has 29 or 30 days, and corresponds to October or November on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Kislev":"Start of month of Kislev on the Hebrew calendar. Kislev (כִּסְלֵו) is the 9th month of the Hebrew year, has 30 or 29 days, and corresponds to November or December on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Tevet":"Start of month of Tevet on the Hebrew calendar. Tevet (טֵבֵת) is the 10th month of the Hebrew year, has 29 days, and corresponds to December or January on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Sh'vat":"Start of month of Sh'vat on the Hebrew calendar. שְׁבָט (transliterated Sh'vat or Shevat) is the 11th month of the Hebrew year, has 30 days, and corresponds to January or February on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Adar":"Start of month of Adar on the Hebrew calendar. Adar (אַדָר) is the 12th month of the Hebrew year, has 29 days, and corresponds to February or March on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Adar I":"Start of month of Adar I (on leap years) on the Hebrew calendar. Adar I (אַדָר א׳) is the 12th month of the Hebrew year, occurs only on leap years, has 30 days, and corresponds to February or March on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Adar II":"Start of month of Adar II (on leap years) on the Hebrew calendar. Adar II (אַדָר ב׳), sometimes \"Adar Bet\" or \"Adar Sheni\", is the 13th month of the Hebrew year, has 29 days, occurs only on leap years, and corresponds to February or March on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Hashana":"The Jewish New Year. Also spelled Rosh Hashanah","Rosh Hashana LaBehemot":"New Year for Tithing Animals","Shabbat Chazon":"Shabbat before Tish'a B'Av (Shabbat of Prophecy/Shabbat of Vision)","Shabbat HaChodesh":"Shabbat before Rosh Chodesh Nissan","Shabbat HaGadol":"Shabbat before Pesach","Shabbat Machar Chodesh":"When Shabbat falls the day before Rosh Chodesh","Shabbat Nachamu":"Shabbat after Tish'a B'Av (Shabbat of Consolation). The first of seven Shabbatot leading up to Rosh Hashanah. Named after the Haftarah (from Isaiah 40) which begins with the verse נַחֲמוּ נַחֲמוּ, עַמִּי (\"Comfort, oh comfort my people\")","Shabbat Parah":"Shabbat of the Red Heifer","Shabbat Rosh Chodesh":"When Shabbat falls on Rosh Chodesh","Shabbat Shekalim":"Shabbat before Rosh Chodesh Adar","Shabbat Shirah":"Shabbat of Song","Shabbat Shuva":"Shabbat that falls between Rosh Hashanah and Yom Kippur (Shabbat of Returning)","Shabbat Zachor":"Shabbat before Purim",Shavuot:Shavuot,"Shmini Atzeret":"Eighth Day of Assembly","Shushan Purim":"Purim celebrated in Jerusalem and walled cities",Sigd:Sigd,"Simchat Torah":"Day of Celebrating the Torah",Sukkot:Sukkot,"Ta'anit Bechorot":"Fast of the First Born","Ta'anit Esther":"Fast of Esther","Tish'a B'Av":"The Ninth of Av. Fast commemorating the destruction of the two Temples","Tu B'Av":"Minor Jewish holiday of love. Observed on the 15th day of the Hebrew month of Av","Tu BiShvat":"New Year for Trees","Tzom Gedaliah":"Fast of the Seventh Month. Commemorates the assassination of the Jewish governor of Judah","Tzom Tammuz":"Fast commemorating breaching of the walls of Jerusalem before the destruction of the Second Temple","Yom HaAliyah":"Recognizes Aliyah, immigration to the Jewish State of Israel","Yom HaAliyah School Observance":"Aliyah Day observed in Israeli schools","Yom HaAtzma'ut":"Israeli Independence Day. Commemorates the declaration of independence of Israel in 1948. Although Yom HaAtzma'ut is normally observed on the 5th of Iyyar, it may be moved earlier or postponed if observance of the holiday (or Yom HaZikaron, which always precedes it) would conflict with Shabbat","Yom HaShoah":"Holocaust Memorial Day","Yom HaZikaron":"Israeli Memorial Day. Remembers those who died in the War of Independence and other wars in Israel. The full name of the holiday is Yom HaZikaron LeHalalei Ma'arakhot Yisrael ul'Nifge'ei Pe'ulot HaEivah (Hebrew: יוֹם הזִּכָּרוֹן לְחַלְלֵי מַעֲרָכוֹת יִשְׂרָאֵל וּלְנִפְגְעֵי פְּעֻלּוֹת הָאֵיבָה), Memorial Day for the Fallen Soldiers of the Wars of Israel and Victims of Actions of Terrorism. Although Yom Hazikaron is normally observed on the 4th of Iyyar, it may be moved earlier or postponed if observance of the holiday (or Yom HaAtzma'ut, which always follows it) would conflict with Shabbat","Yom Kippur":"Day of Atonement","Yom Kippur Katan":"Minor day of atonement occurring monthly on the day preceeding each Rosh Chodesh","Yom Yerushalayim":"Jerusalem Day. Commemorates the re-unification of Jerusalem in 1967"};
|
|
6
6
|
|
|
@@ -52,17 +52,32 @@ function makeAnchor(s) {
|
|
|
52
52
|
*/
|
|
53
53
|
|
|
54
54
|
function getDownloadFilename(options) {
|
|
55
|
-
let fileName = '
|
|
55
|
+
let fileName = 'hebcal';
|
|
56
56
|
|
|
57
|
-
if (options.
|
|
58
|
-
fileName += '
|
|
59
|
-
|
|
57
|
+
if (options.year) {
|
|
58
|
+
fileName += '_' + options.year;
|
|
59
|
+
|
|
60
|
+
if (options.isHebrewYear) {
|
|
61
|
+
fileName += 'h';
|
|
62
|
+
}
|
|
60
63
|
|
|
61
|
-
|
|
62
|
-
|
|
64
|
+
if (options.month) {
|
|
65
|
+
fileName += '_' + options.month;
|
|
66
|
+
}
|
|
67
|
+
} else if (typeof options.start === 'object' && typeof options.end === 'object') {
|
|
68
|
+
const start = new HDate(options.start);
|
|
69
|
+
const end = new HDate(options.end);
|
|
70
|
+
const y1 = start.greg().getFullYear();
|
|
71
|
+
const y2 = end.greg().getFullYear();
|
|
72
|
+
|
|
73
|
+
if (y1 === y2) {
|
|
74
|
+
fileName += '_' + y1;
|
|
75
|
+
} else {
|
|
76
|
+
fileName += '_' + y1 + '_' + y2;
|
|
77
|
+
}
|
|
63
78
|
}
|
|
64
79
|
|
|
65
|
-
if (options.location) {
|
|
80
|
+
if (typeof options.location === 'object') {
|
|
66
81
|
const loc = options.location;
|
|
67
82
|
const name = loc.zip || loc.asciiname || loc.getShortName();
|
|
68
83
|
|
|
@@ -83,7 +98,7 @@ function pad2(number) {
|
|
|
83
98
|
return '0' + number;
|
|
84
99
|
}
|
|
85
100
|
|
|
86
|
-
return
|
|
101
|
+
return '' + number;
|
|
87
102
|
}
|
|
88
103
|
/**
|
|
89
104
|
* @param {number} number
|
|
@@ -101,18 +116,7 @@ function pad4(number) {
|
|
|
101
116
|
return '0' + number;
|
|
102
117
|
}
|
|
103
118
|
|
|
104
|
-
return
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Get offset string (like "+05:00" or "-08:00") from tzid (like "Europe/Moscow")
|
|
108
|
-
* @deprecated
|
|
109
|
-
* @param {string} tzid
|
|
110
|
-
* @param {Date} date
|
|
111
|
-
* @return {string}
|
|
112
|
-
*/
|
|
113
|
-
|
|
114
|
-
function timeZoneOffsetStr(tzid, date) {
|
|
115
|
-
return Zmanim.timeZoneOffset(tzid, date);
|
|
119
|
+
return '' + number;
|
|
116
120
|
}
|
|
117
121
|
/**
|
|
118
122
|
* Returns just the date portion as YYYY-MM-DD
|
|
@@ -123,20 +127,6 @@ function timeZoneOffsetStr(tzid, date) {
|
|
|
123
127
|
function toISOString(d) {
|
|
124
128
|
return pad4(d.getFullYear()) + '-' + pad2(d.getMonth() + 1) + '-' + pad2(d.getDate());
|
|
125
129
|
}
|
|
126
|
-
/**
|
|
127
|
-
* Returns a string like "2018-09-01T12:30:00-05:00"
|
|
128
|
-
* @deprecated
|
|
129
|
-
* @param {Date} date
|
|
130
|
-
* @param {string} timeStr must be formatted with only hours and minutes, like "17:12"
|
|
131
|
-
* @param {string} tzid like "America/New_York"
|
|
132
|
-
* @return {string}
|
|
133
|
-
*/
|
|
134
|
-
|
|
135
|
-
function toISOStringWithTimezone(date, timeStr, tzid) {
|
|
136
|
-
const str = toISOString(date);
|
|
137
|
-
if (!timeStr) return str;
|
|
138
|
-
return str + 'T' + timeStr + ':00' + Zmanim.timeZoneOffset(tzid, date);
|
|
139
|
-
}
|
|
140
130
|
/**
|
|
141
131
|
* Returns a category and subcategory name
|
|
142
132
|
* @param {Event} ev
|
|
@@ -317,7 +307,7 @@ function makeTorahMemoText(ev, il) {
|
|
|
317
307
|
return '';
|
|
318
308
|
}
|
|
319
309
|
|
|
320
|
-
const reading = mask & flags.PARSHA_HASHAVUA ?
|
|
310
|
+
const reading = mask & flags.PARSHA_HASHAVUA ? getLeyningForParshaHaShavua(ev, il) : getLeyningForHoliday(ev, il);
|
|
321
311
|
let memo = '';
|
|
322
312
|
|
|
323
313
|
if (reading && (reading.summary || reading.haftara)) {
|
|
@@ -622,17 +612,17 @@ function eventToClassicApiObject(ev, options, leyning = true) {
|
|
|
622
612
|
if (leyning) {
|
|
623
613
|
const il = options.il;
|
|
624
614
|
const isParsha = mask === flags.PARSHA_HASHAVUA;
|
|
625
|
-
const reading = isParsha ?
|
|
615
|
+
const reading = isParsha ? getLeyningForParshaHaShavua(ev, il) : getLeyningForHoliday(ev, il);
|
|
626
616
|
|
|
627
617
|
if (reading) {
|
|
628
618
|
result.leyning = formatLeyningResult(reading);
|
|
629
619
|
const hyear = hd.getFullYear();
|
|
630
620
|
|
|
631
|
-
if (isParsha && !il && hyear >= 5745
|
|
632
|
-
const triReading =
|
|
621
|
+
if (isParsha && !il && hyear >= 5745) {
|
|
622
|
+
const triReading = getTriennialForParshaHaShavua(ev);
|
|
633
623
|
|
|
634
624
|
if (triReading) {
|
|
635
|
-
result.leyning.triennial = formatAliyot({}, triReading);
|
|
625
|
+
result.leyning.triennial = formatAliyot({}, triReading.aliyot);
|
|
636
626
|
}
|
|
637
627
|
}
|
|
638
628
|
}
|
|
@@ -662,6 +652,17 @@ function eventToClassicApiObject(ev, options, leyning = true) {
|
|
|
662
652
|
};
|
|
663
653
|
}
|
|
664
654
|
|
|
655
|
+
if (mask & flags.HEBREW_DATE) {
|
|
656
|
+
const yy = hd.getFullYear();
|
|
657
|
+
const mm = hd.getMonthName();
|
|
658
|
+
const dd = hd.getDate();
|
|
659
|
+
result.heDateParts = {
|
|
660
|
+
y: gematriya(yy),
|
|
661
|
+
m: Locale.gettext(mm, 'he-x-NoNikud'),
|
|
662
|
+
d: gematriya(dd)
|
|
663
|
+
};
|
|
664
|
+
}
|
|
665
|
+
|
|
665
666
|
const memo = ev.memo || holidayDescription[ev.basename()];
|
|
666
667
|
|
|
667
668
|
if (memo) {
|
|
@@ -688,13 +689,13 @@ function formatAliyot(result, aliyot) {
|
|
|
688
689
|
|
|
689
690
|
if (typeof aliyah !== 'undefined') {
|
|
690
691
|
const k = num == 'M' ? 'maftir' : num;
|
|
691
|
-
result[k] =
|
|
692
|
+
result[k] = formatAliyahWithBook(aliyah);
|
|
692
693
|
}
|
|
693
694
|
});
|
|
694
695
|
return result;
|
|
695
696
|
}
|
|
696
697
|
/**
|
|
697
|
-
* @param {
|
|
698
|
+
* @param {Leyning} reading
|
|
698
699
|
* @return {Object}
|
|
699
700
|
*/
|
|
700
701
|
|
|
@@ -768,32 +769,7 @@ function getLinkAndGuid(ev, il, tzid, mainUrl, utmSource, utmMedium) {
|
|
|
768
769
|
|
|
769
770
|
return [link, guid];
|
|
770
771
|
}
|
|
771
|
-
/**
|
|
772
|
-
* @param {Event[]} events
|
|
773
|
-
* @param {Location} location
|
|
774
|
-
* @param {string} mainUrl
|
|
775
|
-
* @param {string} selfUrl
|
|
776
|
-
* @param {string} [lang] language such as 'he' (default 'en-US')
|
|
777
|
-
* @param {boolean} [evPubDate] if true, use event time as pubDate (false uses lastBuildDate)
|
|
778
|
-
* @return {string}
|
|
779
|
-
*/
|
|
780
|
-
|
|
781
772
|
|
|
782
|
-
function eventsToRss(events, location, mainUrl, selfUrl, lang = 'en-US', evPubDate = true) {
|
|
783
|
-
const cityDescr = location.getName();
|
|
784
|
-
const options = {
|
|
785
|
-
location,
|
|
786
|
-
mainUrl,
|
|
787
|
-
selfUrl,
|
|
788
|
-
lang,
|
|
789
|
-
evPubDate,
|
|
790
|
-
title: Locale.gettext('Shabbat') + ` Times for ${cityDescr}`,
|
|
791
|
-
description: `Weekly Shabbat candle lighting times for ${cityDescr}`,
|
|
792
|
-
utmSource: 'shabbat1c',
|
|
793
|
-
utmMedium: 'rss'
|
|
794
|
-
};
|
|
795
|
-
return eventsToRss2(events, options);
|
|
796
|
-
}
|
|
797
773
|
const localeToLg = {
|
|
798
774
|
's': 'en',
|
|
799
775
|
'a': 'en',
|
|
@@ -874,28 +850,15 @@ function getPubDate(ev, evPubDate, evDate, lastBuildDate) {
|
|
|
874
850
|
|
|
875
851
|
|
|
876
852
|
function eventToRssItem2(ev, options) {
|
|
877
|
-
return eventToRssItem(ev, options.evPubDate, options.lastBuildDate, options.dayFormat, options.location, options.mainUrl, options);
|
|
878
|
-
}
|
|
879
|
-
/**
|
|
880
|
-
* @param {Event} ev
|
|
881
|
-
* @param {boolean} evPubDate
|
|
882
|
-
* @param {string} lastBuildDate
|
|
883
|
-
* @param {Intl.DateTimeFormat} dayFormat
|
|
884
|
-
* @param {Location} location
|
|
885
|
-
* @param {string} mainUrl
|
|
886
|
-
* @param {CalOptions} [options]
|
|
887
|
-
* @return {string}
|
|
888
|
-
*/
|
|
889
|
-
|
|
890
|
-
function eventToRssItem(ev, evPubDate, lastBuildDate, dayFormat, location, mainUrl, options) {
|
|
891
853
|
let subj = ev.render();
|
|
892
854
|
const evDate = ev.getDate().greg();
|
|
893
|
-
const pubDate = getPubDate(ev, evPubDate, evDate, lastBuildDate);
|
|
855
|
+
const pubDate = getPubDate(ev, options.evPubDate, evDate, options.lastBuildDate);
|
|
856
|
+
const location = options.location;
|
|
894
857
|
const il = location ? location.getIsrael() : false;
|
|
895
858
|
const tzid = location ? location.getTzid() : 'UTC';
|
|
896
859
|
const utmSource = options && options.utmSource || 'shabbat1c';
|
|
897
860
|
const utmMedium = options && options.utmMedium || 'rss';
|
|
898
|
-
const linkGuid = getLinkAndGuid(ev, il, tzid, mainUrl, utmSource, utmMedium);
|
|
861
|
+
const linkGuid = getLinkAndGuid(ev, il, tzid, options.mainUrl, utmSource, utmMedium);
|
|
899
862
|
const link = linkGuid[0];
|
|
900
863
|
const guid = linkGuid[1];
|
|
901
864
|
const categories = getEventCategories(ev);
|
|
@@ -920,6 +883,7 @@ function eventToRssItem(ev, evPubDate, lastBuildDate, dayFormat, location, mainU
|
|
|
920
883
|
memo = ev.getFlags() & flags.PARSHA_HASHAVUA ? makeTorahMemoText(ev, il) : ev.memo || holidayDescription[ev.basename()];
|
|
921
884
|
}
|
|
922
885
|
|
|
886
|
+
const dayFormat = options.dayFormat;
|
|
923
887
|
const description = memo || dayFormat.format(evDate);
|
|
924
888
|
const geoTags = cat0 == 'candles' ? `<geo:lat>${location.getLatitude()}</geo:lat>\n<geo:long>${location.getLongitude()}</geo:long>\n` : '';
|
|
925
889
|
return `<item>
|
|
@@ -986,4 +950,4 @@ function eventToFullCalendar(ev, tzid, il) {
|
|
|
986
950
|
return result;
|
|
987
951
|
}
|
|
988
952
|
|
|
989
|
-
export { appendIsraelAndTracking, countryNames, eventToClassicApiObject, eventToCsv, eventToFullCalendar,
|
|
953
|
+
export { appendIsraelAndTracking, countryNames, eventToClassicApiObject, eventToCsv, eventToFullCalendar, eventToRssItem2, eventsToClassicApi, eventsToCsv, eventsToRss2, getCalendarTitle, getDownloadFilename, getEventCategories, getHolidayDescription, holidayDescription, locationToPlainObj, makeAnchor, makeTorahMemoText, pad2, pad4, renderTitleWithoutTime, shouldRenderBrief, toISOString };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hebcal/rest-api",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"author": "Michael J. Radwin (https://github.com/mjradwin)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hebcal"
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"url": "https://github.com/hebcal/hebcal-rest-api/issues"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@hebcal/core": "^3.42.
|
|
25
|
-
"@hebcal/leyning": "^
|
|
24
|
+
"@hebcal/core": "^3.42.2",
|
|
25
|
+
"@hebcal/leyning": "^5.0.0"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"build": "rollup -c",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"verbose": true
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@babel/core": "^7.18.
|
|
46
|
+
"@babel/core": "^7.18.13",
|
|
47
47
|
"@babel/preset-env": "^7.18.10",
|
|
48
48
|
"@babel/register": "^7.18.9",
|
|
49
49
|
"@rollup/plugin-babel": "^5.3.1",
|
|
@@ -52,11 +52,11 @@
|
|
|
52
52
|
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
53
53
|
"ava": "^4.3.1",
|
|
54
54
|
"core-js": "^3.24.1",
|
|
55
|
-
"eslint": "^8.
|
|
55
|
+
"eslint": "^8.22.0",
|
|
56
56
|
"eslint-config-google": "^0.14.0",
|
|
57
57
|
"jsdoc": "^3.6.11",
|
|
58
58
|
"jsdoc-to-markdown": "^7.1.1",
|
|
59
|
-
"rollup": "^2.
|
|
59
|
+
"rollup": "^2.78.1",
|
|
60
60
|
"rollup-plugin-terser": "^7.0.2"
|
|
61
61
|
}
|
|
62
62
|
}
|
package/rest-api.d.ts
CHANGED
|
@@ -35,12 +35,11 @@ declare module '@hebcal/rest-api' {
|
|
|
35
35
|
*/
|
|
36
36
|
export function shouldRenderBrief(ev: Event): boolean;
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
38
|
+
* Extends `CalOptions` with
|
|
39
|
+
* `lang` - language such as 'he' (default 'en-US')
|
|
40
|
+
* `evPubDate` - if true, use event time as pubDate (false uses lastBuildDate)
|
|
40
41
|
*/
|
|
41
|
-
export function eventsToRss(events: Event[], location: Location, mainUrl: string, selfUrl: string, lang?: string, evPubDate?: boolean): string;
|
|
42
42
|
export function eventsToRss2(events: Event[], options: CalOptions): string;
|
|
43
|
-
export function eventToRssItem(ev: Event, evPubDate: boolean, lastBuildDate: string, dayFormat: Intl.DateTimeFormat, location: Location, baseUrl: string, options?: CalOptions): string;
|
|
44
43
|
export function eventToRssItem2(ev: Event, options: CalOptions): string;
|
|
45
44
|
export function getDownloadFilename(options: CalOptions): string;
|
|
46
45
|
export function pad2(number: number): string;
|
|
@@ -50,22 +49,10 @@ declare module '@hebcal/rest-api' {
|
|
|
50
49
|
* Converts to lowercase and replaces non-word characters with hyphen ('-').
|
|
51
50
|
*/
|
|
52
51
|
export function makeAnchor(s: string): string;
|
|
53
|
-
/**
|
|
54
|
-
* Get offset string (like "+05:00" or "-08:00") from tzid (like "Europe/Moscow")
|
|
55
|
-
* @deprecated
|
|
56
|
-
*/
|
|
57
|
-
export function timeZoneOffsetStr(tzid: string, date: Date): string;
|
|
58
52
|
/**
|
|
59
53
|
* Returns just the date portion as YYYY-MM-DD
|
|
60
54
|
*/
|
|
61
55
|
export function toISOString(d: Date): string;
|
|
62
|
-
/**
|
|
63
|
-
* Returns a string like "2018-09-01T12:30:00-05:00'"
|
|
64
|
-
* @deprecated
|
|
65
|
-
* @param timeStr - must be formatted with only hours and minutes, like "17:12"
|
|
66
|
-
* @param tzid - like "America/New_York"
|
|
67
|
-
*/
|
|
68
|
-
export function toISOStringWithTimezone(date: Date, timeStr: string, tzid: string): string;
|
|
69
56
|
/**
|
|
70
57
|
* Returns a category and subcategory name
|
|
71
58
|
*/
|