@hebcal/icalendar 5.0.0 → 5.0.2
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/{index.js → index.cjs} +63 -17
- package/dist/index.mjs +63 -17
- package/package.json +17 -19
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/icalendar v5.0.
|
|
1
|
+
/*! @hebcal/icalendar v5.0.2 */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var core = require('@hebcal/core');
|
|
@@ -6,7 +6,8 @@ var murmurhash3 = require('murmurhash3');
|
|
|
6
6
|
var restApi = require('@hebcal/rest-api');
|
|
7
7
|
var fs = require('fs');
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
// DO NOT EDIT THIS AUTO-GENERATED FILE!
|
|
10
|
+
const version = '5.0.2';
|
|
10
11
|
|
|
11
12
|
const VTIMEZONE = {};
|
|
12
13
|
const CATEGORY = {
|
|
@@ -24,7 +25,7 @@ const CATEGORY = {
|
|
|
24
25
|
parashat: 'Parsha',
|
|
25
26
|
roshchodesh: 'Holiday',
|
|
26
27
|
user: 'Personal',
|
|
27
|
-
zmanim: null
|
|
28
|
+
zmanim: null,
|
|
28
29
|
};
|
|
29
30
|
|
|
30
31
|
/**
|
|
@@ -53,8 +54,10 @@ function appendTrackingToUrl(url, options) {
|
|
|
53
54
|
const utmSource = options.utmSource || 'js';
|
|
54
55
|
const utmMedium = options.utmMedium || 'icalendar';
|
|
55
56
|
const utmCampaign = options.utmCampaign;
|
|
56
|
-
return restApi.appendIsraelAndTracking(url,
|
|
57
|
+
return restApi.appendIsraelAndTracking(url,
|
|
58
|
+
options.il, utmSource, utmMedium, utmCampaign);
|
|
57
59
|
}
|
|
60
|
+
|
|
58
61
|
const encoder = new TextEncoder();
|
|
59
62
|
const char74re = /(.{1,74})/g;
|
|
60
63
|
|
|
@@ -67,7 +70,7 @@ class IcalEvent {
|
|
|
67
70
|
* @param {Event} ev
|
|
68
71
|
* @param {CalOptions} options
|
|
69
72
|
*/
|
|
70
|
-
constructor(ev, options
|
|
73
|
+
constructor(ev, options={}) {
|
|
71
74
|
this.ev = ev;
|
|
72
75
|
this.options = options;
|
|
73
76
|
this.dtstamp = options.dtstamp || IcalEvent.makeDtstamp(new Date());
|
|
@@ -94,7 +97,7 @@ class IcalEvent {
|
|
|
94
97
|
this.locationName = options.location.getShortName();
|
|
95
98
|
}
|
|
96
99
|
const date = IcalEvent.formatYYYYMMDD(ev.getDate().greg());
|
|
97
|
-
this.startDate = date;
|
|
100
|
+
this.startDate = this.isoDateOnly = date;
|
|
98
101
|
this.dtargs = '';
|
|
99
102
|
this.transp = 'TRANSPARENT';
|
|
100
103
|
this.busyStatus = 'FREE';
|
|
@@ -118,6 +121,7 @@ class IcalEvent {
|
|
|
118
121
|
this.busyStatus = 'OOF';
|
|
119
122
|
}
|
|
120
123
|
}
|
|
124
|
+
|
|
121
125
|
if (options.emoji) {
|
|
122
126
|
const prefix = ev.getEmoji();
|
|
123
127
|
if (prefix) {
|
|
@@ -131,6 +135,7 @@ class IcalEvent {
|
|
|
131
135
|
|
|
132
136
|
// make subject safe for iCalendar
|
|
133
137
|
subj = IcalEvent.escape(subj);
|
|
138
|
+
|
|
134
139
|
if (options.appendHebrewToSubject) {
|
|
135
140
|
const hebrew = ev.renderBrief('he');
|
|
136
141
|
if (hebrew) {
|
|
@@ -138,9 +143,10 @@ class IcalEvent {
|
|
|
138
143
|
}
|
|
139
144
|
}
|
|
140
145
|
this.subj = subj;
|
|
141
|
-
this.category = ev.category || CATEGORY[restApi.getEventCategories(ev)[0]];
|
|
146
|
+
this.category = ev.category || CATEGORY[restApi.getEventCategories(ev)?.[0]];
|
|
142
147
|
}
|
|
143
148
|
|
|
149
|
+
|
|
144
150
|
/**
|
|
145
151
|
* @return {string}
|
|
146
152
|
*/
|
|
@@ -171,7 +177,7 @@ class IcalEvent {
|
|
|
171
177
|
getUid() {
|
|
172
178
|
const options = this.options;
|
|
173
179
|
const digest = murmurhash3.murmur32HexSync(this.ev.getDesc());
|
|
174
|
-
let uid = `hebcal-${this.
|
|
180
|
+
let uid = `hebcal-${this.isoDateOnly}-${digest}`;
|
|
175
181
|
if (this.timed && options.location) {
|
|
176
182
|
const loc = options.location;
|
|
177
183
|
if (loc.getGeoId()) {
|
|
@@ -193,16 +199,29 @@ class IcalEvent {
|
|
|
193
199
|
if (this.sequence) {
|
|
194
200
|
categoryLine.unshift(`SEQUENCE:${this.sequence}`);
|
|
195
201
|
}
|
|
196
|
-
const arr = this.lines = [
|
|
202
|
+
const arr = this.lines = [
|
|
203
|
+
'BEGIN:VEVENT',
|
|
204
|
+
`DTSTAMP:${this.dtstamp}`,
|
|
205
|
+
].concat(categoryLine).concat([
|
|
206
|
+
`SUMMARY:${this.subj}`,
|
|
207
|
+
`DTSTART${this.dtargs}:${this.startDate}`,
|
|
208
|
+
`DTEND${this.dtargs}:${this.endDate}`,
|
|
209
|
+
`UID:${uid}`,
|
|
210
|
+
`TRANSP:${this.transp}`,
|
|
211
|
+
`X-MICROSOFT-CDO-BUSYSTATUS:${this.busyStatus}`,
|
|
212
|
+
]);
|
|
213
|
+
|
|
197
214
|
if (!this.timed) {
|
|
198
215
|
arr.push('X-MICROSOFT-CDO-ALLDAYEVENT:TRUE');
|
|
199
216
|
}
|
|
217
|
+
|
|
200
218
|
const ev = this.ev;
|
|
201
219
|
const mask = ev.getFlags();
|
|
202
220
|
const isUserEvent = Boolean(mask & core.flags.USER_EVENT);
|
|
203
221
|
if (!isUserEvent) {
|
|
204
222
|
arr.push('CLASS:PUBLIC');
|
|
205
223
|
}
|
|
224
|
+
|
|
206
225
|
const options = this.options;
|
|
207
226
|
// create memo (holiday descr, Torah, etc)
|
|
208
227
|
const memo = createMemo(ev, options);
|
|
@@ -211,11 +230,20 @@ class IcalEvent {
|
|
|
211
230
|
if (this.timed && options.location) {
|
|
212
231
|
arr.push('GEO:' + options.location.getLatitude() + ';' + options.location.getLongitude());
|
|
213
232
|
}
|
|
233
|
+
|
|
214
234
|
const trigger = this.getAlarm();
|
|
215
235
|
if (trigger) {
|
|
216
|
-
arr.push(
|
|
236
|
+
arr.push(
|
|
237
|
+
'BEGIN:VALARM',
|
|
238
|
+
'ACTION:DISPLAY',
|
|
239
|
+
'DESCRIPTION:Event reminder',
|
|
240
|
+
`${trigger}`,
|
|
241
|
+
'END:VALARM',
|
|
242
|
+
);
|
|
217
243
|
}
|
|
244
|
+
|
|
218
245
|
arr.push('END:VEVENT');
|
|
246
|
+
|
|
219
247
|
return arr;
|
|
220
248
|
}
|
|
221
249
|
|
|
@@ -295,7 +323,8 @@ class IcalEvent {
|
|
|
295
323
|
* @return {string}
|
|
296
324
|
*/
|
|
297
325
|
static formatYYYYMMDD(dt) {
|
|
298
|
-
return restApi.pad4(dt.getFullYear()) +
|
|
326
|
+
return restApi.pad4(dt.getFullYear()) +
|
|
327
|
+
restApi.pad2(dt.getMonth() + 1) + restApi.pad2(dt.getDate());
|
|
299
328
|
}
|
|
300
329
|
|
|
301
330
|
/**
|
|
@@ -305,7 +334,8 @@ class IcalEvent {
|
|
|
305
334
|
*/
|
|
306
335
|
static makeDtstamp(dt) {
|
|
307
336
|
const s = dt.toISOString();
|
|
308
|
-
return s.slice(0, 4) + s.slice(5, 7) + s.slice(8, 13) +
|
|
337
|
+
return s.slice(0, 4) + s.slice(5, 7) + s.slice(8, 13) +
|
|
338
|
+
s.slice(14, 16) + s.slice(17, 19) + 'Z';
|
|
309
339
|
}
|
|
310
340
|
|
|
311
341
|
/** @return {string} */
|
|
@@ -324,8 +354,13 @@ function eventToIcal(ev, options) {
|
|
|
324
354
|
const ical = new IcalEvent(ev, options);
|
|
325
355
|
return ical.toString();
|
|
326
356
|
}
|
|
357
|
+
|
|
327
358
|
const torahMemoCache = new Map();
|
|
328
|
-
|
|
359
|
+
|
|
360
|
+
const HOLIDAY_IGNORE_MASK = core.flags.DAF_YOMI | core.flags.OMER_COUNT |
|
|
361
|
+
core.flags.SHABBAT_MEVARCHIM | core.flags.MOLAD | core.flags.USER_EVENT |
|
|
362
|
+
core.flags.MISHNA_YOMI | core.flags.YERUSHALMI_YOMI | core.flags.NACH_YOMI |
|
|
363
|
+
core.flags.HEBREW_DATE;
|
|
329
364
|
|
|
330
365
|
/**
|
|
331
366
|
* @private
|
|
@@ -334,7 +369,7 @@ const HOLIDAY_IGNORE_MASK = core.flags.DAF_YOMI | core.flags.OMER_COUNT | core.f
|
|
|
334
369
|
* @return {string}
|
|
335
370
|
*/
|
|
336
371
|
function makeTorahMemo(ev, il) {
|
|
337
|
-
if (ev.getFlags() & HOLIDAY_IGNORE_MASK || ev.eventTime) {
|
|
372
|
+
if ((ev.getFlags() & HOLIDAY_IGNORE_MASK) || ev.eventTime) {
|
|
338
373
|
return '';
|
|
339
374
|
}
|
|
340
375
|
const hd = ev.getDate();
|
|
@@ -409,7 +444,7 @@ async function eventsToIcalendar(events, options) {
|
|
|
409
444
|
if (!opts.title) {
|
|
410
445
|
opts.title = restApi.getCalendarTitle(events, opts);
|
|
411
446
|
}
|
|
412
|
-
const icals = events.map(ev => new IcalEvent(ev, opts));
|
|
447
|
+
const icals = events.map((ev) => new IcalEvent(ev, opts));
|
|
413
448
|
return icalEventsToString(icals, opts);
|
|
414
449
|
}
|
|
415
450
|
|
|
@@ -425,9 +460,19 @@ async function icalEventsToString(icals, options) {
|
|
|
425
460
|
const opts = Object.assign({}, options);
|
|
426
461
|
opts.dtstamp = opts.dtstamp || IcalEvent.makeDtstamp(new Date());
|
|
427
462
|
const title = opts.title ? IcalEvent.escape(opts.title) : 'Untitled';
|
|
428
|
-
const caldesc = opts.caldesc ? IcalEvent.escape(opts.caldesc) :
|
|
463
|
+
const caldesc = opts.caldesc ? IcalEvent.escape(opts.caldesc) :
|
|
464
|
+
opts.yahrzeit ?
|
|
465
|
+
'Yahrzeits + Anniversaries from www.hebcal.com' :
|
|
466
|
+
'Jewish Holidays from www.hebcal.com';
|
|
429
467
|
const prodid = opts.prodid || `-//hebcal.com/NONSGML Hebcal Calendar v1${version}//${uclang}`;
|
|
430
|
-
const preamble = [
|
|
468
|
+
const preamble = [
|
|
469
|
+
'BEGIN:VCALENDAR',
|
|
470
|
+
'VERSION:2.0',
|
|
471
|
+
`PRODID:${prodid}`,
|
|
472
|
+
'CALSCALE:GREGORIAN',
|
|
473
|
+
'METHOD:PUBLISH',
|
|
474
|
+
'X-LOTUS-CHARSET:UTF-8',
|
|
475
|
+
];
|
|
431
476
|
if (opts.publishedTTL !== false) {
|
|
432
477
|
const publishedTTL = opts.publishedTTL || 'PT7D';
|
|
433
478
|
preamble.push(`X-PUBLISHED-TTL:${publishedTTL}`);
|
|
@@ -467,6 +512,7 @@ async function icalEventsToString(icals, options) {
|
|
|
467
512
|
}
|
|
468
513
|
}
|
|
469
514
|
}
|
|
515
|
+
|
|
470
516
|
for (const ical of icals) {
|
|
471
517
|
const lines = ical.getLines();
|
|
472
518
|
for (const line of lines) {
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
/*! @hebcal/icalendar v5.0.
|
|
1
|
+
/*! @hebcal/icalendar v5.0.2 */
|
|
2
2
|
import { flags, Locale, greg } from '@hebcal/core';
|
|
3
3
|
import { murmur32HexSync } from 'murmurhash3';
|
|
4
4
|
import { shouldRenderBrief, pad2, getEventCategories, makeAnchor, pad4, getHolidayDescription, getCalendarTitle, appendIsraelAndTracking, makeTorahMemoText } from '@hebcal/rest-api';
|
|
5
5
|
import { promises } from 'fs';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
// DO NOT EDIT THIS AUTO-GENERATED FILE!
|
|
8
|
+
const version = '5.0.2';
|
|
8
9
|
|
|
9
10
|
const VTIMEZONE = {};
|
|
10
11
|
const CATEGORY = {
|
|
@@ -22,7 +23,7 @@ const CATEGORY = {
|
|
|
22
23
|
parashat: 'Parsha',
|
|
23
24
|
roshchodesh: 'Holiday',
|
|
24
25
|
user: 'Personal',
|
|
25
|
-
zmanim: null
|
|
26
|
+
zmanim: null,
|
|
26
27
|
};
|
|
27
28
|
|
|
28
29
|
/**
|
|
@@ -51,8 +52,10 @@ function appendTrackingToUrl(url, options) {
|
|
|
51
52
|
const utmSource = options.utmSource || 'js';
|
|
52
53
|
const utmMedium = options.utmMedium || 'icalendar';
|
|
53
54
|
const utmCampaign = options.utmCampaign;
|
|
54
|
-
return appendIsraelAndTracking(url,
|
|
55
|
+
return appendIsraelAndTracking(url,
|
|
56
|
+
options.il, utmSource, utmMedium, utmCampaign);
|
|
55
57
|
}
|
|
58
|
+
|
|
56
59
|
const encoder = new TextEncoder();
|
|
57
60
|
const char74re = /(.{1,74})/g;
|
|
58
61
|
|
|
@@ -65,7 +68,7 @@ class IcalEvent {
|
|
|
65
68
|
* @param {Event} ev
|
|
66
69
|
* @param {CalOptions} options
|
|
67
70
|
*/
|
|
68
|
-
constructor(ev, options
|
|
71
|
+
constructor(ev, options={}) {
|
|
69
72
|
this.ev = ev;
|
|
70
73
|
this.options = options;
|
|
71
74
|
this.dtstamp = options.dtstamp || IcalEvent.makeDtstamp(new Date());
|
|
@@ -92,7 +95,7 @@ class IcalEvent {
|
|
|
92
95
|
this.locationName = options.location.getShortName();
|
|
93
96
|
}
|
|
94
97
|
const date = IcalEvent.formatYYYYMMDD(ev.getDate().greg());
|
|
95
|
-
this.startDate = date;
|
|
98
|
+
this.startDate = this.isoDateOnly = date;
|
|
96
99
|
this.dtargs = '';
|
|
97
100
|
this.transp = 'TRANSPARENT';
|
|
98
101
|
this.busyStatus = 'FREE';
|
|
@@ -116,6 +119,7 @@ class IcalEvent {
|
|
|
116
119
|
this.busyStatus = 'OOF';
|
|
117
120
|
}
|
|
118
121
|
}
|
|
122
|
+
|
|
119
123
|
if (options.emoji) {
|
|
120
124
|
const prefix = ev.getEmoji();
|
|
121
125
|
if (prefix) {
|
|
@@ -129,6 +133,7 @@ class IcalEvent {
|
|
|
129
133
|
|
|
130
134
|
// make subject safe for iCalendar
|
|
131
135
|
subj = IcalEvent.escape(subj);
|
|
136
|
+
|
|
132
137
|
if (options.appendHebrewToSubject) {
|
|
133
138
|
const hebrew = ev.renderBrief('he');
|
|
134
139
|
if (hebrew) {
|
|
@@ -136,9 +141,10 @@ class IcalEvent {
|
|
|
136
141
|
}
|
|
137
142
|
}
|
|
138
143
|
this.subj = subj;
|
|
139
|
-
this.category = ev.category || CATEGORY[getEventCategories(ev)[0]];
|
|
144
|
+
this.category = ev.category || CATEGORY[getEventCategories(ev)?.[0]];
|
|
140
145
|
}
|
|
141
146
|
|
|
147
|
+
|
|
142
148
|
/**
|
|
143
149
|
* @return {string}
|
|
144
150
|
*/
|
|
@@ -169,7 +175,7 @@ class IcalEvent {
|
|
|
169
175
|
getUid() {
|
|
170
176
|
const options = this.options;
|
|
171
177
|
const digest = murmur32HexSync(this.ev.getDesc());
|
|
172
|
-
let uid = `hebcal-${this.
|
|
178
|
+
let uid = `hebcal-${this.isoDateOnly}-${digest}`;
|
|
173
179
|
if (this.timed && options.location) {
|
|
174
180
|
const loc = options.location;
|
|
175
181
|
if (loc.getGeoId()) {
|
|
@@ -191,16 +197,29 @@ class IcalEvent {
|
|
|
191
197
|
if (this.sequence) {
|
|
192
198
|
categoryLine.unshift(`SEQUENCE:${this.sequence}`);
|
|
193
199
|
}
|
|
194
|
-
const arr = this.lines = [
|
|
200
|
+
const arr = this.lines = [
|
|
201
|
+
'BEGIN:VEVENT',
|
|
202
|
+
`DTSTAMP:${this.dtstamp}`,
|
|
203
|
+
].concat(categoryLine).concat([
|
|
204
|
+
`SUMMARY:${this.subj}`,
|
|
205
|
+
`DTSTART${this.dtargs}:${this.startDate}`,
|
|
206
|
+
`DTEND${this.dtargs}:${this.endDate}`,
|
|
207
|
+
`UID:${uid}`,
|
|
208
|
+
`TRANSP:${this.transp}`,
|
|
209
|
+
`X-MICROSOFT-CDO-BUSYSTATUS:${this.busyStatus}`,
|
|
210
|
+
]);
|
|
211
|
+
|
|
195
212
|
if (!this.timed) {
|
|
196
213
|
arr.push('X-MICROSOFT-CDO-ALLDAYEVENT:TRUE');
|
|
197
214
|
}
|
|
215
|
+
|
|
198
216
|
const ev = this.ev;
|
|
199
217
|
const mask = ev.getFlags();
|
|
200
218
|
const isUserEvent = Boolean(mask & flags.USER_EVENT);
|
|
201
219
|
if (!isUserEvent) {
|
|
202
220
|
arr.push('CLASS:PUBLIC');
|
|
203
221
|
}
|
|
222
|
+
|
|
204
223
|
const options = this.options;
|
|
205
224
|
// create memo (holiday descr, Torah, etc)
|
|
206
225
|
const memo = createMemo(ev, options);
|
|
@@ -209,11 +228,20 @@ class IcalEvent {
|
|
|
209
228
|
if (this.timed && options.location) {
|
|
210
229
|
arr.push('GEO:' + options.location.getLatitude() + ';' + options.location.getLongitude());
|
|
211
230
|
}
|
|
231
|
+
|
|
212
232
|
const trigger = this.getAlarm();
|
|
213
233
|
if (trigger) {
|
|
214
|
-
arr.push(
|
|
234
|
+
arr.push(
|
|
235
|
+
'BEGIN:VALARM',
|
|
236
|
+
'ACTION:DISPLAY',
|
|
237
|
+
'DESCRIPTION:Event reminder',
|
|
238
|
+
`${trigger}`,
|
|
239
|
+
'END:VALARM',
|
|
240
|
+
);
|
|
215
241
|
}
|
|
242
|
+
|
|
216
243
|
arr.push('END:VEVENT');
|
|
244
|
+
|
|
217
245
|
return arr;
|
|
218
246
|
}
|
|
219
247
|
|
|
@@ -293,7 +321,8 @@ class IcalEvent {
|
|
|
293
321
|
* @return {string}
|
|
294
322
|
*/
|
|
295
323
|
static formatYYYYMMDD(dt) {
|
|
296
|
-
return pad4(dt.getFullYear()) +
|
|
324
|
+
return pad4(dt.getFullYear()) +
|
|
325
|
+
pad2(dt.getMonth() + 1) + pad2(dt.getDate());
|
|
297
326
|
}
|
|
298
327
|
|
|
299
328
|
/**
|
|
@@ -303,7 +332,8 @@ class IcalEvent {
|
|
|
303
332
|
*/
|
|
304
333
|
static makeDtstamp(dt) {
|
|
305
334
|
const s = dt.toISOString();
|
|
306
|
-
return s.slice(0, 4) + s.slice(5, 7) + s.slice(8, 13) +
|
|
335
|
+
return s.slice(0, 4) + s.slice(5, 7) + s.slice(8, 13) +
|
|
336
|
+
s.slice(14, 16) + s.slice(17, 19) + 'Z';
|
|
307
337
|
}
|
|
308
338
|
|
|
309
339
|
/** @return {string} */
|
|
@@ -322,8 +352,13 @@ function eventToIcal(ev, options) {
|
|
|
322
352
|
const ical = new IcalEvent(ev, options);
|
|
323
353
|
return ical.toString();
|
|
324
354
|
}
|
|
355
|
+
|
|
325
356
|
const torahMemoCache = new Map();
|
|
326
|
-
|
|
357
|
+
|
|
358
|
+
const HOLIDAY_IGNORE_MASK = flags.DAF_YOMI | flags.OMER_COUNT |
|
|
359
|
+
flags.SHABBAT_MEVARCHIM | flags.MOLAD | flags.USER_EVENT |
|
|
360
|
+
flags.MISHNA_YOMI | flags.YERUSHALMI_YOMI | flags.NACH_YOMI |
|
|
361
|
+
flags.HEBREW_DATE;
|
|
327
362
|
|
|
328
363
|
/**
|
|
329
364
|
* @private
|
|
@@ -332,7 +367,7 @@ const HOLIDAY_IGNORE_MASK = flags.DAF_YOMI | flags.OMER_COUNT | flags.SHABBAT_ME
|
|
|
332
367
|
* @return {string}
|
|
333
368
|
*/
|
|
334
369
|
function makeTorahMemo(ev, il) {
|
|
335
|
-
if (ev.getFlags() & HOLIDAY_IGNORE_MASK || ev.eventTime) {
|
|
370
|
+
if ((ev.getFlags() & HOLIDAY_IGNORE_MASK) || ev.eventTime) {
|
|
336
371
|
return '';
|
|
337
372
|
}
|
|
338
373
|
const hd = ev.getDate();
|
|
@@ -407,7 +442,7 @@ async function eventsToIcalendar(events, options) {
|
|
|
407
442
|
if (!opts.title) {
|
|
408
443
|
opts.title = getCalendarTitle(events, opts);
|
|
409
444
|
}
|
|
410
|
-
const icals = events.map(ev => new IcalEvent(ev, opts));
|
|
445
|
+
const icals = events.map((ev) => new IcalEvent(ev, opts));
|
|
411
446
|
return icalEventsToString(icals, opts);
|
|
412
447
|
}
|
|
413
448
|
|
|
@@ -423,9 +458,19 @@ async function icalEventsToString(icals, options) {
|
|
|
423
458
|
const opts = Object.assign({}, options);
|
|
424
459
|
opts.dtstamp = opts.dtstamp || IcalEvent.makeDtstamp(new Date());
|
|
425
460
|
const title = opts.title ? IcalEvent.escape(opts.title) : 'Untitled';
|
|
426
|
-
const caldesc = opts.caldesc ? IcalEvent.escape(opts.caldesc) :
|
|
461
|
+
const caldesc = opts.caldesc ? IcalEvent.escape(opts.caldesc) :
|
|
462
|
+
opts.yahrzeit ?
|
|
463
|
+
'Yahrzeits + Anniversaries from www.hebcal.com' :
|
|
464
|
+
'Jewish Holidays from www.hebcal.com';
|
|
427
465
|
const prodid = opts.prodid || `-//hebcal.com/NONSGML Hebcal Calendar v1${version}//${uclang}`;
|
|
428
|
-
const preamble = [
|
|
466
|
+
const preamble = [
|
|
467
|
+
'BEGIN:VCALENDAR',
|
|
468
|
+
'VERSION:2.0',
|
|
469
|
+
`PRODID:${prodid}`,
|
|
470
|
+
'CALSCALE:GREGORIAN',
|
|
471
|
+
'METHOD:PUBLISH',
|
|
472
|
+
'X-LOTUS-CHARSET:UTF-8',
|
|
473
|
+
];
|
|
429
474
|
if (opts.publishedTTL !== false) {
|
|
430
475
|
const publishedTTL = opts.publishedTTL || 'PT7D';
|
|
431
476
|
preamble.push(`X-PUBLISHED-TTL:${publishedTTL}`);
|
|
@@ -465,6 +510,7 @@ async function icalEventsToString(icals, options) {
|
|
|
465
510
|
}
|
|
466
511
|
}
|
|
467
512
|
}
|
|
513
|
+
|
|
468
514
|
for (const ical of icals) {
|
|
469
515
|
const lines = ical.getLines();
|
|
470
516
|
for (const line of lines) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hebcal/icalendar",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.2",
|
|
4
4
|
"author": "Michael J. Radwin (https://github.com/mjradwin)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ical",
|
|
@@ -9,8 +9,13 @@
|
|
|
9
9
|
"hebcal"
|
|
10
10
|
],
|
|
11
11
|
"description": "Jewish holidays and Hebrew calendar as iCalendar RFC 2445",
|
|
12
|
-
"main": "dist/index.
|
|
12
|
+
"main": "dist/index.cjs",
|
|
13
13
|
"module": "dist/index.mjs",
|
|
14
|
+
"type": "module",
|
|
15
|
+
"exports": {
|
|
16
|
+
"import": "./dist/index.mjs",
|
|
17
|
+
"require": "./dist/index.cjs"
|
|
18
|
+
},
|
|
14
19
|
"typings": "icalendar.d.ts",
|
|
15
20
|
"files": [
|
|
16
21
|
"dist",
|
|
@@ -24,36 +29,29 @@
|
|
|
24
29
|
"url": "https://github.com/hebcal/hebcal-icalendar/issues"
|
|
25
30
|
},
|
|
26
31
|
"dependencies": {
|
|
27
|
-
"@hebcal/core": "^5.0.
|
|
28
|
-
"@hebcal/rest-api": "^5.0.
|
|
32
|
+
"@hebcal/core": "^5.0.3",
|
|
33
|
+
"@hebcal/rest-api": "^5.0.2",
|
|
29
34
|
"murmurhash3": "^0.5.0"
|
|
30
35
|
},
|
|
31
36
|
"scripts": {
|
|
32
|
-
"build": "rollup -c",
|
|
37
|
+
"build:rollup": "rollup -c",
|
|
38
|
+
"build:version": "node ./version.cjs package.json src/pkgVersion.js",
|
|
39
|
+
"build": "npm run build:version && npm run build:rollup",
|
|
33
40
|
"prepare": "npm run build",
|
|
34
41
|
"pretest": "npm run build",
|
|
35
42
|
"readme": "npx jsdoc2md dist/index.js",
|
|
36
43
|
"test": "ava"
|
|
37
44
|
},
|
|
38
45
|
"license": "BSD-2-Clause",
|
|
39
|
-
"ava": {
|
|
40
|
-
"require": [
|
|
41
|
-
"@babel/register"
|
|
42
|
-
]
|
|
43
|
-
},
|
|
44
46
|
"devDependencies": {
|
|
45
|
-
"@
|
|
46
|
-
"@babel/preset-env": "^7.23.3",
|
|
47
|
-
"@babel/register": "^7.22.15",
|
|
48
|
-
"@hebcal/learning": "^5.0.0",
|
|
49
|
-
"@rollup/plugin-babel": "^6.0.4",
|
|
47
|
+
"@hebcal/learning": "^5.0.2",
|
|
50
48
|
"@rollup/plugin-commonjs": "^25.0.7",
|
|
51
|
-
"@rollup/plugin-json": "^6.0
|
|
52
|
-
"ava": "^
|
|
53
|
-
"eslint": "^8.
|
|
49
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
50
|
+
"ava": "^6.0.1",
|
|
51
|
+
"eslint": "^8.56.0",
|
|
54
52
|
"eslint-config-google": "^0.14.0",
|
|
55
53
|
"jsdoc": "^4.0.2",
|
|
56
54
|
"jsdoc-to-markdown": "^8.0.0",
|
|
57
|
-
"rollup": "^4.
|
|
55
|
+
"rollup": "^4.9.1"
|
|
58
56
|
}
|
|
59
57
|
}
|