@hebcal/rest-api 5.1.4 → 5.2.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/dist/bundle.js +119 -77
- package/dist/bundle.min.js +2 -2
- package/dist/common.d.ts +1 -1
- package/dist/fullcalendar.js +39 -26
- package/dist/fullcalendar.min.js +2 -2
- package/dist/index.cjs +119 -77
- package/dist/index.mjs +120 -78
- package/dist/module.d.ts +1 -1
- package/package.json +12 -7
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @hebcal/rest-api v5.
|
|
2
|
-
import { parshiot, HDate, flags, HebrewCalendar, Zmanim, Locale as Locale$1, gematriya } from '@hebcal/core';
|
|
1
|
+
/*! @hebcal/rest-api v5.2.0 */
|
|
2
|
+
import { parshiot, HDate, flags, HebrewCalendar, version, Zmanim, Locale as Locale$1, gematriya } from '@hebcal/core';
|
|
3
3
|
import { getLeyningForParshaHaShavua, getLeyningForHoliday, formatAliyahWithBook } from '@hebcal/leyning';
|
|
4
4
|
import { getTriennialForParshaHaShavua } from '@hebcal/triennial';
|
|
5
5
|
|
|
@@ -706,7 +706,8 @@ var holidayDescription0 = {
|
|
|
706
706
|
* makeAnchor('Rosh Chodesh Adar II') // 'rosh-chodesh-adar-ii'
|
|
707
707
|
*/
|
|
708
708
|
function makeAnchor(s) {
|
|
709
|
-
return s
|
|
709
|
+
return s
|
|
710
|
+
.toLowerCase()
|
|
710
711
|
.replace(/'/g, '')
|
|
711
712
|
.replace(/[^\w]/g, '-')
|
|
712
713
|
.replace(/-+/g, '-')
|
|
@@ -732,7 +733,7 @@ const doubled = new Set();
|
|
|
732
733
|
for (const name of doubledParshiyot) {
|
|
733
734
|
const anchor = makeAnchor(name);
|
|
734
735
|
doubled.add(anchor);
|
|
735
|
-
const [p1
|
|
736
|
+
const [p1] = anchor.split('-');
|
|
736
737
|
const id = parsha2id.get(p1);
|
|
737
738
|
parsha2id.set(anchor, id);
|
|
738
739
|
}
|
|
@@ -775,14 +776,25 @@ function shortenSedrotUrl(u) {
|
|
|
775
776
|
}
|
|
776
777
|
}
|
|
777
778
|
|
|
778
|
-
const LOC_FIELDS = [
|
|
779
|
+
const LOC_FIELDS = [
|
|
780
|
+
'elevation',
|
|
781
|
+
'admin1',
|
|
782
|
+
'asciiname',
|
|
783
|
+
'geo',
|
|
784
|
+
'zip',
|
|
785
|
+
'state',
|
|
786
|
+
'stateName',
|
|
787
|
+
'geonameid',
|
|
788
|
+
];
|
|
779
789
|
const holidayDescription = holidayDescription0;
|
|
780
790
|
const countryNames = countryNames0;
|
|
781
791
|
/**
|
|
782
792
|
* Converts a @hebcal/core `Location` to a plain JS object.
|
|
783
793
|
*/
|
|
784
794
|
function locationToPlainObj(location) {
|
|
785
|
-
if (typeof location === 'object' &&
|
|
795
|
+
if (typeof location === 'object' &&
|
|
796
|
+
location !== null &&
|
|
797
|
+
typeof location.getLatitude === 'function') {
|
|
786
798
|
const cc = location.getCountryCode();
|
|
787
799
|
const o = {
|
|
788
800
|
title: location.getName(),
|
|
@@ -816,7 +828,8 @@ function getDownloadFilename(options) {
|
|
|
816
828
|
fileName += '_' + options.month;
|
|
817
829
|
}
|
|
818
830
|
}
|
|
819
|
-
else if (typeof options.start === 'object' &&
|
|
831
|
+
else if (typeof options.start === 'object' &&
|
|
832
|
+
typeof options.end === 'object') {
|
|
820
833
|
const start = new HDate(options.start);
|
|
821
834
|
const end = new HDate(options.end);
|
|
822
835
|
const y1 = start.greg().getFullYear();
|
|
@@ -857,7 +870,9 @@ function getEventCategories(ev) {
|
|
|
857
870
|
* Renders the event title in default locale, but strips off time
|
|
858
871
|
*/
|
|
859
872
|
function renderTitleWithoutTime(ev) {
|
|
860
|
-
return typeof ev.eventTime === 'undefined'
|
|
873
|
+
return typeof ev.eventTime === 'undefined'
|
|
874
|
+
? ev.render()
|
|
875
|
+
: ev.renderBrief();
|
|
861
876
|
}
|
|
862
877
|
function shortLocationName(options) {
|
|
863
878
|
const loc = options.location;
|
|
@@ -890,19 +905,20 @@ function getCalendarTitle(events, options) {
|
|
|
890
905
|
else {
|
|
891
906
|
title += ' Diaspora';
|
|
892
907
|
}
|
|
893
|
-
|
|
908
|
+
const sub = options.subscribe;
|
|
909
|
+
if (sub === '1' || sub === 1 || sub === true) {
|
|
894
910
|
return title;
|
|
895
911
|
}
|
|
896
|
-
if (options.year && (options.isHebrewYear || events.length
|
|
912
|
+
if (options.year && (options.isHebrewYear || events.length === 0)) {
|
|
897
913
|
title += ' ' + options.year;
|
|
898
914
|
}
|
|
899
915
|
else if (events.length) {
|
|
900
916
|
const start = events[0].getDate().greg();
|
|
901
917
|
const end = events[events.length - 1].getDate().greg();
|
|
902
|
-
if (start.getFullYear()
|
|
918
|
+
if (start.getFullYear() !== end.getFullYear()) {
|
|
903
919
|
title += ' ' + start.getFullYear() + '-' + end.getFullYear();
|
|
904
920
|
}
|
|
905
|
-
else if (start.getMonth()
|
|
921
|
+
else if (start.getMonth() === end.getMonth()) {
|
|
906
922
|
const monthFormat = new Intl.DateTimeFormat('en-US', { month: 'long' });
|
|
907
923
|
const startMonth = monthFormat.format(start);
|
|
908
924
|
title += ' ' + startMonth + ' ' + start.getFullYear();
|
|
@@ -917,34 +933,42 @@ function getCalendarTitle(events, options) {
|
|
|
917
933
|
* Returns an English language description of the holiday
|
|
918
934
|
*/
|
|
919
935
|
function getHolidayDescription(ev, firstSentence = false) {
|
|
920
|
-
const str0 = ev.getFlags() & flags.SHABBAT_MEVARCHIM
|
|
921
|
-
holidayDescription['Shabbat Mevarchim Chodesh']
|
|
922
|
-
holidayDescription[ev.getDesc()] ||
|
|
936
|
+
const str0 = ev.getFlags() & flags.SHABBAT_MEVARCHIM
|
|
937
|
+
? holidayDescription['Shabbat Mevarchim Chodesh']
|
|
938
|
+
: holidayDescription[ev.getDesc()] ||
|
|
939
|
+
holidayDescription[ev.basename()] ||
|
|
940
|
+
'';
|
|
923
941
|
const str = str0.normalize();
|
|
924
942
|
if (firstSentence && str) {
|
|
925
943
|
const dot = str.indexOf('.');
|
|
926
|
-
if (dot
|
|
944
|
+
if (dot !== -1) {
|
|
927
945
|
return str.substring(0, dot);
|
|
928
946
|
}
|
|
929
947
|
}
|
|
930
948
|
return str;
|
|
931
949
|
}
|
|
932
|
-
const HOLIDAY_IGNORE_MASK = flags.DAF_YOMI |
|
|
933
|
-
flags.
|
|
934
|
-
flags.
|
|
935
|
-
flags.
|
|
950
|
+
const HOLIDAY_IGNORE_MASK = flags.DAF_YOMI |
|
|
951
|
+
flags.OMER_COUNT |
|
|
952
|
+
flags.SHABBAT_MEVARCHIM |
|
|
953
|
+
flags.MOLAD |
|
|
954
|
+
flags.USER_EVENT |
|
|
955
|
+
flags.NACH_YOMI |
|
|
956
|
+
flags.DAILY_LEARNING |
|
|
957
|
+
flags.HEBREW_DATE |
|
|
958
|
+
flags.YERUSHALMI_YOMI;
|
|
936
959
|
/**
|
|
937
960
|
* Makes mulit-line text that summarizes Torah & Haftarah
|
|
938
961
|
*/
|
|
939
962
|
function makeTorahMemoText(ev, il) {
|
|
940
963
|
var _a;
|
|
941
964
|
const mask = ev.getFlags();
|
|
942
|
-
if (
|
|
965
|
+
if (mask & HOLIDAY_IGNORE_MASK ||
|
|
966
|
+
typeof ev.eventTime !== 'undefined') {
|
|
943
967
|
return '';
|
|
944
968
|
}
|
|
945
|
-
const reading =
|
|
946
|
-
getLeyningForParshaHaShavua(ev, il)
|
|
947
|
-
getLeyningForHoliday(ev, il);
|
|
969
|
+
const reading = mask & flags.PARSHA_HASHAVUA
|
|
970
|
+
? getLeyningForParshaHaShavua(ev, il)
|
|
971
|
+
: getLeyningForHoliday(ev, il);
|
|
948
972
|
let memo = '';
|
|
949
973
|
if (reading && (reading.summary || reading.haftara)) {
|
|
950
974
|
if (reading.summary) {
|
|
@@ -1004,10 +1028,12 @@ function appendIsraelAndTracking(url, il, utmSource, utmMedium, utmCampaign) {
|
|
|
1004
1028
|
else if (isSedrot) {
|
|
1005
1029
|
shortenSedrotUrl(u);
|
|
1006
1030
|
}
|
|
1007
|
-
else {
|
|
1031
|
+
else {
|
|
1032
|
+
// isOmer
|
|
1008
1033
|
u.pathname = '/o/' + path.substring(6);
|
|
1009
1034
|
}
|
|
1010
|
-
if (!utmCampaign ||
|
|
1035
|
+
if (!utmCampaign ||
|
|
1036
|
+
!(utmCampaign.startsWith('ical-') || utmCampaign.startsWith('pdf-'))) {
|
|
1011
1037
|
if (utmSource) {
|
|
1012
1038
|
u.searchParams.set('us', utmSource);
|
|
1013
1039
|
}
|
|
@@ -1040,12 +1066,14 @@ function shouldRenderBrief(ev) {
|
|
|
1040
1066
|
const mask = ev.getFlags();
|
|
1041
1067
|
if (mask & flags.HEBREW_DATE) {
|
|
1042
1068
|
const hd = ev.getDate();
|
|
1043
|
-
return
|
|
1069
|
+
return hd.getDate() === 1 ? false : true;
|
|
1044
1070
|
}
|
|
1045
|
-
else if (mask &
|
|
1071
|
+
else if (mask &
|
|
1072
|
+
(flags.DAILY_LEARNING | flags.DAF_YOMI | flags.YERUSHALMI_YOMI)) {
|
|
1046
1073
|
return true;
|
|
1047
1074
|
}
|
|
1048
|
-
else if (mask & flags.MINOR_FAST &&
|
|
1075
|
+
else if (mask & flags.MINOR_FAST &&
|
|
1076
|
+
ev.getDesc().substring(0, 16) === 'Yom Kippur Katan') {
|
|
1049
1077
|
return true;
|
|
1050
1078
|
}
|
|
1051
1079
|
else if (mask & flags.SHABBAT_MEVARCHIM) {
|
|
@@ -1081,15 +1109,20 @@ function eventToCsv(ev, options) {
|
|
|
1081
1109
|
const mday = d.getDate();
|
|
1082
1110
|
const mon = d.getMonth() + 1;
|
|
1083
1111
|
const year = String(d.getFullYear()).padStart(4, '0');
|
|
1084
|
-
const date = options.euro
|
|
1112
|
+
const date = options.euro
|
|
1113
|
+
? `"${mday}/${mon}/${year}"`
|
|
1114
|
+
: `"${mon}/${mday}/${year}"`;
|
|
1085
1115
|
let startTime = '';
|
|
1086
1116
|
let endTime = '';
|
|
1087
1117
|
let endDate = '';
|
|
1088
1118
|
let allDay = '"true"';
|
|
1089
|
-
const
|
|
1090
|
-
|
|
1119
|
+
const timedEv = ev;
|
|
1120
|
+
const timed = Boolean(timedEv.eventTime);
|
|
1121
|
+
let subj = shouldRenderBrief(ev)
|
|
1122
|
+
? ev.renderBrief(options.locale)
|
|
1123
|
+
: ev.render(options.locale);
|
|
1091
1124
|
if (timed) {
|
|
1092
|
-
const timeStr = HebrewCalendar.reformatTimeStr(
|
|
1125
|
+
const timeStr = HebrewCalendar.reformatTimeStr(timedEv.eventTimeStr, ' PM', options);
|
|
1093
1126
|
endTime = startTime = `"${timeStr}"`;
|
|
1094
1127
|
endDate = date;
|
|
1095
1128
|
allDay = '"false"';
|
|
@@ -1108,7 +1141,7 @@ function eventToCsv(ev, options) {
|
|
|
1108
1141
|
loc = category;
|
|
1109
1142
|
}
|
|
1110
1143
|
}
|
|
1111
|
-
subj = subj.replace(/,/g, '').replace(/"/g, '
|
|
1144
|
+
subj = subj.replace(/,/g, '').replace(/"/g, "''");
|
|
1112
1145
|
if (options.appendHebrewToSubject) {
|
|
1113
1146
|
const hebrew = ev.renderBrief('he');
|
|
1114
1147
|
if (hebrew) {
|
|
@@ -1116,15 +1149,19 @@ function eventToCsv(ev, options) {
|
|
|
1116
1149
|
}
|
|
1117
1150
|
}
|
|
1118
1151
|
let memo0 = ev.memo || getHolidayDescription(ev, true);
|
|
1119
|
-
if (!memo0 && typeof
|
|
1120
|
-
memo0 =
|
|
1121
|
-
}
|
|
1122
|
-
const memo = memo0
|
|
1123
|
-
|
|
1152
|
+
if (!memo0 && typeof timedEv.linkedEvent !== 'undefined') {
|
|
1153
|
+
memo0 = timedEv.linkedEvent.render(options.locale);
|
|
1154
|
+
}
|
|
1155
|
+
const memo = memo0
|
|
1156
|
+
.replace(/,/g, ';')
|
|
1157
|
+
.replace(/"/g, "''")
|
|
1158
|
+
.replace(/\n/g, ' / ');
|
|
1159
|
+
const showTimeAs = timed || mask & flags.CHAG ? 4 : 3;
|
|
1124
1160
|
return `"${subj}",${date},${startTime},${endDate},${endTime},${allDay},"${memo}","${showTimeAs}","${loc}"`;
|
|
1125
1161
|
}
|
|
1126
1162
|
function eventsToCsv(events, options) {
|
|
1127
|
-
return [csvHeader].concat(events.map(
|
|
1163
|
+
return ([csvHeader].concat(events.map(ev => eventToCsv(ev, options))).join('\r\n') +
|
|
1164
|
+
'\r\n');
|
|
1128
1165
|
}
|
|
1129
1166
|
|
|
1130
1167
|
function eventIsoDate(ev) {
|
|
@@ -1137,6 +1174,7 @@ function eventsToClassicApi(events, options, leyning = true) {
|
|
|
1137
1174
|
const result = {
|
|
1138
1175
|
title: getCalendarTitle(events, options),
|
|
1139
1176
|
date: new Date().toISOString(),
|
|
1177
|
+
version,
|
|
1140
1178
|
};
|
|
1141
1179
|
result.location = locationToPlainObj(options.location);
|
|
1142
1180
|
if (events.length) {
|
|
@@ -1145,28 +1183,31 @@ function eventsToClassicApi(events, options, leyning = true) {
|
|
|
1145
1183
|
end: eventIsoDate(events[events.length - 1]),
|
|
1146
1184
|
};
|
|
1147
1185
|
}
|
|
1148
|
-
result.items = events.map(
|
|
1186
|
+
result.items = events.map(ev => eventToClassicApiObject(ev, options, leyning));
|
|
1149
1187
|
return result;
|
|
1150
1188
|
}
|
|
1151
1189
|
/**
|
|
1152
1190
|
* Converts a Hebcal event to a classic Hebcal.com JSON API object
|
|
1153
1191
|
*/
|
|
1154
1192
|
function eventToClassicApiObject(ev, options, leyning = true) {
|
|
1155
|
-
const
|
|
1193
|
+
const timedEv = ev;
|
|
1194
|
+
const eventTime = timedEv.eventTime;
|
|
1156
1195
|
const timed = Boolean(eventTime);
|
|
1157
1196
|
const hd = ev.getDate();
|
|
1158
1197
|
const dt = hd.greg();
|
|
1159
1198
|
const tzid = typeof options.location === 'object' ? options.location.getTzid() : 'UTC';
|
|
1160
|
-
const date = timed
|
|
1161
|
-
Zmanim.formatISOWithTimeZone(tzid, eventTime)
|
|
1162
|
-
isoDateString(dt);
|
|
1199
|
+
const date = timed
|
|
1200
|
+
? Zmanim.formatISOWithTimeZone(tzid, eventTime)
|
|
1201
|
+
: isoDateString(dt);
|
|
1163
1202
|
const categories = getEventCategories(ev);
|
|
1164
1203
|
const mask = ev.getFlags();
|
|
1165
|
-
let title = shouldRenderBrief(ev)
|
|
1204
|
+
let title = shouldRenderBrief(ev)
|
|
1205
|
+
? ev.renderBrief(options.locale)
|
|
1206
|
+
: ev.render(options.locale);
|
|
1166
1207
|
const desc = ev.getDesc();
|
|
1167
1208
|
const candles = desc === 'Havdalah' || desc === 'Candle lighting';
|
|
1168
1209
|
if (candles) {
|
|
1169
|
-
const time = HebrewCalendar.reformatTimeStr(
|
|
1210
|
+
const time = HebrewCalendar.reformatTimeStr(timedEv.eventTimeStr, 'pm', options);
|
|
1170
1211
|
title += ': ' + time;
|
|
1171
1212
|
}
|
|
1172
1213
|
const result = {
|
|
@@ -1180,10 +1221,10 @@ function eventToClassicApiObject(ev, options, leyning = true) {
|
|
|
1180
1221
|
if (categories.length > 1) {
|
|
1181
1222
|
result.subcat = categories[1];
|
|
1182
1223
|
}
|
|
1183
|
-
if (categories[0] === 'holiday' &&
|
|
1224
|
+
if (categories[0] === 'holiday' && mask & flags.CHAG) {
|
|
1184
1225
|
result.yomtov = true;
|
|
1185
1226
|
}
|
|
1186
|
-
if (title
|
|
1227
|
+
if (title !== desc) {
|
|
1187
1228
|
result.title_orig = desc;
|
|
1188
1229
|
}
|
|
1189
1230
|
const hebrew = ev.renderBrief('he');
|
|
@@ -1193,10 +1234,10 @@ function eventToClassicApiObject(ev, options, leyning = true) {
|
|
|
1193
1234
|
if (!candles) {
|
|
1194
1235
|
if (leyning) {
|
|
1195
1236
|
const il = options.il;
|
|
1196
|
-
const isParsha =
|
|
1197
|
-
const reading = isParsha
|
|
1198
|
-
getLeyningForParshaHaShavua(ev, il)
|
|
1199
|
-
getLeyningForHoliday(ev, il);
|
|
1237
|
+
const isParsha = mask === flags.PARSHA_HASHAVUA;
|
|
1238
|
+
const reading = isParsha
|
|
1239
|
+
? getLeyningForParshaHaShavua(ev, il)
|
|
1240
|
+
: getLeyningForHoliday(ev, il);
|
|
1200
1241
|
if (reading) {
|
|
1201
1242
|
result.leyning = formatLeyningResult(reading);
|
|
1202
1243
|
const hyear = hd.getFullYear();
|
|
@@ -1244,7 +1285,7 @@ function eventToClassicApiObject(ev, options, leyning = true) {
|
|
|
1244
1285
|
};
|
|
1245
1286
|
delete result.hebrew;
|
|
1246
1287
|
}
|
|
1247
|
-
if ((options.heDateParts && !timed) ||
|
|
1288
|
+
if ((options.heDateParts && !timed) || mask & flags.HEBREW_DATE) {
|
|
1248
1289
|
const yy = hd.getFullYear();
|
|
1249
1290
|
const mm = hd.getMonthName();
|
|
1250
1291
|
const dd = hd.getDate();
|
|
@@ -1258,8 +1299,8 @@ function eventToClassicApiObject(ev, options, leyning = true) {
|
|
|
1258
1299
|
if (typeof memo === 'string' && memo.length !== 0) {
|
|
1259
1300
|
result.memo = memo.normalize();
|
|
1260
1301
|
}
|
|
1261
|
-
else if (typeof
|
|
1262
|
-
result.memo =
|
|
1302
|
+
else if (typeof timedEv.linkedEvent !== 'undefined') {
|
|
1303
|
+
result.memo = timedEv.linkedEvent.render(options.locale);
|
|
1263
1304
|
}
|
|
1264
1305
|
if (options.includeEvent) {
|
|
1265
1306
|
result.ev = ev;
|
|
@@ -1269,7 +1310,7 @@ function eventToClassicApiObject(ev, options, leyning = true) {
|
|
|
1269
1310
|
function formatAliyot(result, aliyot) {
|
|
1270
1311
|
for (const [num, aliyah] of Object.entries(aliyot)) {
|
|
1271
1312
|
if (typeof aliyah !== 'undefined') {
|
|
1272
|
-
const k = num
|
|
1313
|
+
const k = num === 'M' ? 'maftir' : num;
|
|
1273
1314
|
result[k] = formatAliyahWithBook(aliyah);
|
|
1274
1315
|
}
|
|
1275
1316
|
}
|
|
@@ -1278,7 +1319,7 @@ function formatAliyot(result, aliyot) {
|
|
|
1278
1319
|
function formatReasons(result, reason) {
|
|
1279
1320
|
for (const num of ['7', '8', 'M']) {
|
|
1280
1321
|
if (reason[num]) {
|
|
1281
|
-
const k = num
|
|
1322
|
+
const k = num === 'M' ? 'maftir' : num;
|
|
1282
1323
|
result[k] += ' | ' + reason[num];
|
|
1283
1324
|
}
|
|
1284
1325
|
}
|
|
@@ -1331,12 +1372,12 @@ function getLinkAndGuid(ev, il, tzid, mainUrl, utmSource, utmMedium) {
|
|
|
1331
1372
|
return [link, guid];
|
|
1332
1373
|
}
|
|
1333
1374
|
const localeToLg = {
|
|
1334
|
-
|
|
1335
|
-
|
|
1375
|
+
s: 'en',
|
|
1376
|
+
a: 'en',
|
|
1336
1377
|
'he-x-NoNikud': 'he',
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1378
|
+
h: 'he',
|
|
1379
|
+
ah: 'en',
|
|
1380
|
+
sh: 'en',
|
|
1340
1381
|
};
|
|
1341
1382
|
function eventsToRss2(events, options) {
|
|
1342
1383
|
options.dayFormat = new Intl.DateTimeFormat('en-US', {
|
|
@@ -1349,9 +1390,9 @@ function eventsToRss2(events, options) {
|
|
|
1349
1390
|
if (!options.mainUrl || !options.selfUrl) {
|
|
1350
1391
|
throw new TypeError('mainUrl cannot be empty or blank');
|
|
1351
1392
|
}
|
|
1352
|
-
const buildDate = options.buildDate = options.buildDate || new Date();
|
|
1393
|
+
const buildDate = (options.buildDate = options.buildDate || new Date());
|
|
1353
1394
|
const thisYear = buildDate.getFullYear();
|
|
1354
|
-
const lastBuildDate = options.lastBuildDate = buildDate.toUTCString();
|
|
1395
|
+
const lastBuildDate = (options.lastBuildDate = buildDate.toUTCString());
|
|
1355
1396
|
const title = options.title || getCalendarTitle(events, options);
|
|
1356
1397
|
const description = options.description || title;
|
|
1357
1398
|
const utmSource = options.utmSource || 'shabbat1c';
|
|
@@ -1406,7 +1447,7 @@ function eventToRssItem2(ev, options) {
|
|
|
1406
1447
|
let memo;
|
|
1407
1448
|
if (candles) {
|
|
1408
1449
|
const colon = subj.indexOf(': ');
|
|
1409
|
-
if (colon
|
|
1450
|
+
if (colon !== -1) {
|
|
1410
1451
|
const options = { location, il, locale: Locale$1.getLocaleName() };
|
|
1411
1452
|
const time = HebrewCalendar.reformatTimeStr(ev.eventTimeStr, 'pm', options);
|
|
1412
1453
|
subj = subj.substring(0, colon) + ': ' + time;
|
|
@@ -1416,11 +1457,11 @@ function eventToRssItem2(ev, options) {
|
|
|
1416
1457
|
memo = makeMemo(ev, il);
|
|
1417
1458
|
}
|
|
1418
1459
|
const dayFormat = options.dayFormat;
|
|
1419
|
-
const
|
|
1420
|
-
const description =
|
|
1421
|
-
const geoTags =
|
|
1422
|
-
`<geo:lat>${location.getLatitude()}</geo:lat>\n<geo:long>${location.getLongitude()}</geo:long>\n`
|
|
1423
|
-
'';
|
|
1460
|
+
const tmp = memo || dayFormat.format(evDate);
|
|
1461
|
+
const description = tmp.indexOf('<') === -1 ? tmp : `<![CDATA[${tmp}]]>`;
|
|
1462
|
+
const geoTags = cat0 === 'candles'
|
|
1463
|
+
? `<geo:lat>${location.getLatitude()}</geo:lat>\n<geo:long>${location.getLongitude()}</geo:long>\n`
|
|
1464
|
+
: '';
|
|
1424
1465
|
return `<item>
|
|
1425
1466
|
<title>${subj}</title>
|
|
1426
1467
|
<link>${link}</link>
|
|
@@ -1438,15 +1479,16 @@ ${geoTags}</item>
|
|
|
1438
1479
|
function eventToFullCalendar(ev, tzid, il) {
|
|
1439
1480
|
const classes = getEventCategories(ev);
|
|
1440
1481
|
const mask = ev.getFlags();
|
|
1441
|
-
if (classes[0]
|
|
1482
|
+
if (classes[0] === 'holiday' && mask & flags.CHAG) {
|
|
1442
1483
|
classes.push('yomtov');
|
|
1443
1484
|
}
|
|
1444
|
-
const
|
|
1485
|
+
const timedEv = ev;
|
|
1486
|
+
const eventTime = timedEv.eventTime;
|
|
1445
1487
|
const timed = Boolean(eventTime);
|
|
1446
1488
|
const title = shouldRenderBrief(ev) ? ev.renderBrief() : ev.render();
|
|
1447
|
-
const start = timed
|
|
1448
|
-
Zmanim.formatISOWithTimeZone(tzid, eventTime)
|
|
1449
|
-
isoDateString(ev.getDate().greg());
|
|
1489
|
+
const start = timed
|
|
1490
|
+
? Zmanim.formatISOWithTimeZone(tzid, eventTime)
|
|
1491
|
+
: isoDateString(ev.getDate().greg());
|
|
1450
1492
|
const result = {
|
|
1451
1493
|
title,
|
|
1452
1494
|
start,
|
|
@@ -1468,8 +1510,8 @@ function eventToFullCalendar(ev, tzid, il) {
|
|
|
1468
1510
|
if (memo) {
|
|
1469
1511
|
result.description = memo;
|
|
1470
1512
|
}
|
|
1471
|
-
else if (typeof
|
|
1472
|
-
result.description =
|
|
1513
|
+
else if (typeof timedEv.linkedEvent !== 'undefined') {
|
|
1514
|
+
result.description = timedEv.linkedEvent.render();
|
|
1473
1515
|
}
|
|
1474
1516
|
}
|
|
1475
1517
|
return result;
|
package/dist/module.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hebcal/rest-api",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0",
|
|
4
4
|
"author": "Michael J. Radwin (https://github.com/mjradwin)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hebcal"
|
|
@@ -30,7 +30,8 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@hebcal/core": "^5.5.2",
|
|
33
|
-
"@hebcal/
|
|
33
|
+
"@hebcal/hdate": "^0.11.5",
|
|
34
|
+
"@hebcal/leyning": "^8.2.7",
|
|
34
35
|
"@hebcal/triennial": "^5.1.3"
|
|
35
36
|
},
|
|
36
37
|
"scripts": {
|
|
@@ -40,25 +41,29 @@
|
|
|
40
41
|
"prepublish": "npm run build",
|
|
41
42
|
"pretest": "npm run build",
|
|
42
43
|
"docs": "typedoc",
|
|
44
|
+
"lint": "gts lint",
|
|
45
|
+
"coverage": "jest --coverage",
|
|
46
|
+
"clean": "gts clean",
|
|
47
|
+
"fix": "gts fix",
|
|
43
48
|
"test": "jest"
|
|
44
49
|
},
|
|
45
50
|
"license": "BSD-2-Clause",
|
|
46
51
|
"devDependencies": {
|
|
47
|
-
"@babel/preset-env": "^7.25.
|
|
52
|
+
"@babel/preset-env": "^7.25.8",
|
|
48
53
|
"@babel/preset-typescript": "^7.25.7",
|
|
49
54
|
"@hebcal/learning": "^5.1.1",
|
|
50
|
-
"@rollup/plugin-commonjs": "^28.0.
|
|
55
|
+
"@rollup/plugin-commonjs": "^28.0.1",
|
|
51
56
|
"@rollup/plugin-json": "^6.1.0",
|
|
52
57
|
"@rollup/plugin-node-resolve": "^15.3.0",
|
|
53
58
|
"@rollup/plugin-terser": "^0.4.4",
|
|
54
|
-
"@rollup/plugin-typescript": "^12.1.
|
|
59
|
+
"@rollup/plugin-typescript": "^12.1.1",
|
|
55
60
|
"@types/jest": "^29.5.13",
|
|
56
61
|
"gts": "^5.3.1",
|
|
57
62
|
"jest": "^29.7.0",
|
|
58
63
|
"rollup": "^4.24.0",
|
|
59
64
|
"rollup-plugin-dts": "^6.1.1",
|
|
60
65
|
"ts-jest": "^29.2.5",
|
|
61
|
-
"typedoc": "^0.26.
|
|
62
|
-
"typescript": "^5.6.
|
|
66
|
+
"typedoc": "^0.26.10",
|
|
67
|
+
"typescript": "^5.6.3"
|
|
63
68
|
}
|
|
64
69
|
}
|