@hebcal/icalendar 5.0.4 → 5.0.6
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.cjs +20 -21
- package/dist/index.mjs +20 -21
- package/package.json +7 -7
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/icalendar v5.0.
|
|
1
|
+
/*! @hebcal/icalendar v5.0.6 */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var core = require('@hebcal/core');
|
|
@@ -7,7 +7,7 @@ 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.
|
|
10
|
+
const version = '5.0.6';
|
|
11
11
|
|
|
12
12
|
const vtimezoneCache = new Map();
|
|
13
13
|
const CATEGORY = {
|
|
@@ -61,6 +61,9 @@ function appendTrackingToUrl(url, options) {
|
|
|
61
61
|
const encoder = new TextEncoder();
|
|
62
62
|
const char74re = /(.{1,74})/g;
|
|
63
63
|
|
|
64
|
+
const DAILY_LEARNING = core.flags.DAILY_LEARNING | core.flags.DAF_YOMI |
|
|
65
|
+
core.flags.MISHNA_YOMI | core.flags.YERUSHALMI_YOMI | core.flags.NACH_YOMI;
|
|
66
|
+
|
|
64
67
|
/**
|
|
65
68
|
* Represents an RFC 2445 iCalendar VEVENT
|
|
66
69
|
*/
|
|
@@ -81,20 +84,15 @@ class IcalEvent {
|
|
|
81
84
|
}
|
|
82
85
|
const timed = this.timed = Boolean(ev.eventTime);
|
|
83
86
|
const locale = options.locale;
|
|
87
|
+
const location = options.location;
|
|
84
88
|
let subj = restApi.shouldRenderBrief(ev) ? ev.renderBrief(locale) : ev.render(locale);
|
|
85
89
|
const mask = ev.getFlags();
|
|
86
90
|
if (ev.locationName) {
|
|
87
91
|
this.locationName = ev.locationName;
|
|
88
|
-
} else if (
|
|
89
|
-
this.locationName =
|
|
90
|
-
} else if (mask &
|
|
91
|
-
this.locationName = core.Locale.gettext(
|
|
92
|
-
} else if (mask & core.flags.NACH_YOMI) {
|
|
93
|
-
this.locationName = core.Locale.gettext('Nach Yomi');
|
|
94
|
-
} else if (mask & core.flags.MISHNA_YOMI) {
|
|
95
|
-
this.locationName = core.Locale.gettext('Mishna Yomi');
|
|
96
|
-
} else if (timed && options.location) {
|
|
97
|
-
this.locationName = options.location.getShortName();
|
|
92
|
+
} else if (timed && location) {
|
|
93
|
+
this.locationName = location.getShortName();
|
|
94
|
+
} else if ((mask & DAILY_LEARNING) && ev.category) {
|
|
95
|
+
this.locationName = core.Locale.gettext(ev.category, locale);
|
|
98
96
|
}
|
|
99
97
|
const date = IcalEvent.formatYYYYMMDD(ev.getDate().greg());
|
|
100
98
|
this.startDate = this.isoDateOnly = date;
|
|
@@ -107,8 +105,8 @@ class IcalEvent {
|
|
|
107
105
|
minute = +minute;
|
|
108
106
|
this.startDate += 'T' + restApi.pad2(hour) + restApi.pad2(minute) + '00';
|
|
109
107
|
this.endDate = this.startDate;
|
|
110
|
-
if (
|
|
111
|
-
this.dtargs = `;TZID=${
|
|
108
|
+
if (location?.getTzid()) {
|
|
109
|
+
this.dtargs = `;TZID=${location.getTzid()}`;
|
|
112
110
|
}
|
|
113
111
|
} else {
|
|
114
112
|
this.endDate = IcalEvent.formatYYYYMMDD(ev.getDate().next().greg());
|
|
@@ -178,8 +176,8 @@ class IcalEvent {
|
|
|
178
176
|
const options = this.options;
|
|
179
177
|
const digest = murmurhash3.murmur32HexSync(this.ev.getDesc());
|
|
180
178
|
let uid = `hebcal-${this.isoDateOnly}-${digest}`;
|
|
181
|
-
|
|
182
|
-
|
|
179
|
+
const loc = options.location;
|
|
180
|
+
if (this.timed && loc) {
|
|
183
181
|
if (loc.getGeoId()) {
|
|
184
182
|
uid += `-${loc.getGeoId()}`;
|
|
185
183
|
} else if (loc.getName()) {
|
|
@@ -227,8 +225,9 @@ class IcalEvent {
|
|
|
227
225
|
const memo = createMemo(ev, options);
|
|
228
226
|
addOptional(arr, 'DESCRIPTION', memo);
|
|
229
227
|
addOptional(arr, 'LOCATION', this.locationName);
|
|
230
|
-
|
|
231
|
-
|
|
228
|
+
const loc = options.location;
|
|
229
|
+
if (this.timed && loc) {
|
|
230
|
+
arr.push('GEO:' + loc.getLatitude() + ';' + loc.getLongitude());
|
|
232
231
|
}
|
|
233
232
|
|
|
234
233
|
const trigger = this.getAlarm();
|
|
@@ -357,9 +356,8 @@ function eventToIcal(ev, options) {
|
|
|
357
356
|
|
|
358
357
|
const torahMemoCache = new Map();
|
|
359
358
|
|
|
360
|
-
const HOLIDAY_IGNORE_MASK =
|
|
359
|
+
const HOLIDAY_IGNORE_MASK = DAILY_LEARNING | core.flags.OMER_COUNT |
|
|
361
360
|
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
361
|
core.flags.HEBREW_DATE;
|
|
364
362
|
|
|
365
363
|
/**
|
|
@@ -456,7 +454,8 @@ async function eventsToIcalendar(events, options) {
|
|
|
456
454
|
*/
|
|
457
455
|
async function icalEventsToString(icals, options) {
|
|
458
456
|
const stream = [];
|
|
459
|
-
const
|
|
457
|
+
const locale = options.locale || core.Locale.getLocaleName();
|
|
458
|
+
const uclang = locale.toUpperCase();
|
|
460
459
|
const opts = Object.assign({}, options);
|
|
461
460
|
opts.dtstamp = opts.dtstamp || IcalEvent.makeDtstamp(new Date());
|
|
462
461
|
const title = opts.title ? IcalEvent.escape(opts.title) : 'Untitled';
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/*! @hebcal/icalendar v5.0.
|
|
1
|
+
/*! @hebcal/icalendar v5.0.6 */
|
|
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.
|
|
8
|
+
const version = '5.0.6';
|
|
9
9
|
|
|
10
10
|
const vtimezoneCache = new Map();
|
|
11
11
|
const CATEGORY = {
|
|
@@ -59,6 +59,9 @@ function appendTrackingToUrl(url, options) {
|
|
|
59
59
|
const encoder = new TextEncoder();
|
|
60
60
|
const char74re = /(.{1,74})/g;
|
|
61
61
|
|
|
62
|
+
const DAILY_LEARNING = flags.DAILY_LEARNING | flags.DAF_YOMI |
|
|
63
|
+
flags.MISHNA_YOMI | flags.YERUSHALMI_YOMI | flags.NACH_YOMI;
|
|
64
|
+
|
|
62
65
|
/**
|
|
63
66
|
* Represents an RFC 2445 iCalendar VEVENT
|
|
64
67
|
*/
|
|
@@ -79,20 +82,15 @@ class IcalEvent {
|
|
|
79
82
|
}
|
|
80
83
|
const timed = this.timed = Boolean(ev.eventTime);
|
|
81
84
|
const locale = options.locale;
|
|
85
|
+
const location = options.location;
|
|
82
86
|
let subj = shouldRenderBrief(ev) ? ev.renderBrief(locale) : ev.render(locale);
|
|
83
87
|
const mask = ev.getFlags();
|
|
84
88
|
if (ev.locationName) {
|
|
85
89
|
this.locationName = ev.locationName;
|
|
86
|
-
} else if (
|
|
87
|
-
this.locationName =
|
|
88
|
-
} else if (mask &
|
|
89
|
-
this.locationName = Locale.gettext(
|
|
90
|
-
} else if (mask & flags.NACH_YOMI) {
|
|
91
|
-
this.locationName = Locale.gettext('Nach Yomi');
|
|
92
|
-
} else if (mask & flags.MISHNA_YOMI) {
|
|
93
|
-
this.locationName = Locale.gettext('Mishna Yomi');
|
|
94
|
-
} else if (timed && options.location) {
|
|
95
|
-
this.locationName = options.location.getShortName();
|
|
90
|
+
} else if (timed && location) {
|
|
91
|
+
this.locationName = location.getShortName();
|
|
92
|
+
} else if ((mask & DAILY_LEARNING) && ev.category) {
|
|
93
|
+
this.locationName = Locale.gettext(ev.category, locale);
|
|
96
94
|
}
|
|
97
95
|
const date = IcalEvent.formatYYYYMMDD(ev.getDate().greg());
|
|
98
96
|
this.startDate = this.isoDateOnly = date;
|
|
@@ -105,8 +103,8 @@ class IcalEvent {
|
|
|
105
103
|
minute = +minute;
|
|
106
104
|
this.startDate += 'T' + pad2(hour) + pad2(minute) + '00';
|
|
107
105
|
this.endDate = this.startDate;
|
|
108
|
-
if (
|
|
109
|
-
this.dtargs = `;TZID=${
|
|
106
|
+
if (location?.getTzid()) {
|
|
107
|
+
this.dtargs = `;TZID=${location.getTzid()}`;
|
|
110
108
|
}
|
|
111
109
|
} else {
|
|
112
110
|
this.endDate = IcalEvent.formatYYYYMMDD(ev.getDate().next().greg());
|
|
@@ -176,8 +174,8 @@ class IcalEvent {
|
|
|
176
174
|
const options = this.options;
|
|
177
175
|
const digest = murmur32HexSync(this.ev.getDesc());
|
|
178
176
|
let uid = `hebcal-${this.isoDateOnly}-${digest}`;
|
|
179
|
-
|
|
180
|
-
|
|
177
|
+
const loc = options.location;
|
|
178
|
+
if (this.timed && loc) {
|
|
181
179
|
if (loc.getGeoId()) {
|
|
182
180
|
uid += `-${loc.getGeoId()}`;
|
|
183
181
|
} else if (loc.getName()) {
|
|
@@ -225,8 +223,9 @@ class IcalEvent {
|
|
|
225
223
|
const memo = createMemo(ev, options);
|
|
226
224
|
addOptional(arr, 'DESCRIPTION', memo);
|
|
227
225
|
addOptional(arr, 'LOCATION', this.locationName);
|
|
228
|
-
|
|
229
|
-
|
|
226
|
+
const loc = options.location;
|
|
227
|
+
if (this.timed && loc) {
|
|
228
|
+
arr.push('GEO:' + loc.getLatitude() + ';' + loc.getLongitude());
|
|
230
229
|
}
|
|
231
230
|
|
|
232
231
|
const trigger = this.getAlarm();
|
|
@@ -355,9 +354,8 @@ function eventToIcal(ev, options) {
|
|
|
355
354
|
|
|
356
355
|
const torahMemoCache = new Map();
|
|
357
356
|
|
|
358
|
-
const HOLIDAY_IGNORE_MASK =
|
|
357
|
+
const HOLIDAY_IGNORE_MASK = DAILY_LEARNING | flags.OMER_COUNT |
|
|
359
358
|
flags.SHABBAT_MEVARCHIM | flags.MOLAD | flags.USER_EVENT |
|
|
360
|
-
flags.MISHNA_YOMI | flags.YERUSHALMI_YOMI | flags.NACH_YOMI |
|
|
361
359
|
flags.HEBREW_DATE;
|
|
362
360
|
|
|
363
361
|
/**
|
|
@@ -454,7 +452,8 @@ async function eventsToIcalendar(events, options) {
|
|
|
454
452
|
*/
|
|
455
453
|
async function icalEventsToString(icals, options) {
|
|
456
454
|
const stream = [];
|
|
457
|
-
const
|
|
455
|
+
const locale = options.locale || Locale.getLocaleName();
|
|
456
|
+
const uclang = locale.toUpperCase();
|
|
458
457
|
const opts = Object.assign({}, options);
|
|
459
458
|
opts.dtstamp = opts.dtstamp || IcalEvent.makeDtstamp(new Date());
|
|
460
459
|
const title = opts.title ? IcalEvent.escape(opts.title) : 'Untitled';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hebcal/icalendar",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.6",
|
|
4
4
|
"author": "Michael J. Radwin (https://github.com/mjradwin)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ical",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"url": "https://github.com/hebcal/hebcal-icalendar/issues"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@hebcal/core": "^5.
|
|
34
|
-
"@hebcal/rest-api": "^5.0.
|
|
33
|
+
"@hebcal/core": "^5.2.2",
|
|
34
|
+
"@hebcal/rest-api": "^5.0.3",
|
|
35
35
|
"murmurhash3": "^0.5.0"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
@@ -45,14 +45,14 @@
|
|
|
45
45
|
},
|
|
46
46
|
"license": "BSD-2-Clause",
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@hebcal/learning": "^5.0.
|
|
48
|
+
"@hebcal/learning": "^5.0.7",
|
|
49
49
|
"@rollup/plugin-commonjs": "^25.0.7",
|
|
50
50
|
"@rollup/plugin-json": "^6.1.0",
|
|
51
|
-
"ava": "^6.
|
|
51
|
+
"ava": "^6.1.1",
|
|
52
52
|
"eslint": "^8.56.0",
|
|
53
53
|
"eslint-config-google": "^0.14.0",
|
|
54
54
|
"jsdoc": "^4.0.2",
|
|
55
|
-
"jsdoc-to-markdown": "^8.0.
|
|
56
|
-
"rollup": "^4.
|
|
55
|
+
"jsdoc-to-markdown": "^8.0.1",
|
|
56
|
+
"rollup": "^4.12.0"
|
|
57
57
|
}
|
|
58
58
|
}
|