@hebcal/icalendar 4.15.4 → 4.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +37 -14
- package/dist/index.mjs +38 -15
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/icalendar v4.
|
|
1
|
+
/*! @hebcal/icalendar v4.17.1 */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
@@ -8,7 +8,7 @@ var murmurhash3 = require('murmurhash3');
|
|
|
8
8
|
var restApi = require('@hebcal/rest-api');
|
|
9
9
|
var fs = require('fs');
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
const version="4.17.1";
|
|
12
12
|
|
|
13
13
|
const VTIMEZONE = {};
|
|
14
14
|
const CATEGORY = {
|
|
@@ -123,7 +123,11 @@ class IcalEvent {
|
|
|
123
123
|
const prefix = ev.getEmoji();
|
|
124
124
|
|
|
125
125
|
if (prefix) {
|
|
126
|
-
|
|
126
|
+
if (mask & core.flags.OMER_COUNT) {
|
|
127
|
+
subj = subj + ' ' + prefix;
|
|
128
|
+
} else {
|
|
129
|
+
subj = prefix + ' ' + subj;
|
|
130
|
+
}
|
|
127
131
|
}
|
|
128
132
|
} // make subject safe for iCalendar
|
|
129
133
|
|
|
@@ -139,19 +143,32 @@ class IcalEvent {
|
|
|
139
143
|
}
|
|
140
144
|
|
|
141
145
|
this.subj = subj;
|
|
142
|
-
|
|
146
|
+
this.category = ev.category || CATEGORY[restApi.getEventCategories(ev)[0]];
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* @return {string}
|
|
150
|
+
*/
|
|
143
151
|
|
|
144
|
-
|
|
145
|
-
|
|
152
|
+
|
|
153
|
+
getAlarm() {
|
|
154
|
+
const ev = this.ev;
|
|
155
|
+
const mask = ev.getFlags();
|
|
156
|
+
const evAlarm = ev.alarm;
|
|
157
|
+
|
|
158
|
+
if (typeof evAlarm === 'string') {
|
|
159
|
+
return 'TRIGGER:' + evAlarm;
|
|
160
|
+
} else if (core.greg.isDate(evAlarm)) {
|
|
161
|
+
evAlarm.setSeconds(0);
|
|
162
|
+
return 'TRIGGER;VALUE=DATE-TIME:' + IcalEvent.makeDtstamp(evAlarm);
|
|
146
163
|
} else if (mask & core.flags.OMER_COUNT) {
|
|
147
|
-
|
|
148
|
-
} else if (
|
|
149
|
-
|
|
150
|
-
} else if (timed && ev.getDesc().startsWith('Candle lighting')) {
|
|
151
|
-
|
|
164
|
+
return 'TRIGGER:-P0DT3H30M0S'; // 8:30pm Omer alarm evening before
|
|
165
|
+
} else if (mask & core.flags.USER_EVENT) {
|
|
166
|
+
return 'TRIGGER:-P0DT12H0M0S'; // noon the day before
|
|
167
|
+
} else if (this.timed && ev.getDesc().startsWith('Candle lighting')) {
|
|
168
|
+
return 'TRIGGER:-P0DT0H10M0S';
|
|
152
169
|
}
|
|
153
170
|
|
|
154
|
-
|
|
171
|
+
return null;
|
|
155
172
|
}
|
|
156
173
|
/**
|
|
157
174
|
* @return {string}
|
|
@@ -206,8 +223,10 @@ class IcalEvent {
|
|
|
206
223
|
arr.push('GEO:' + options.location.latitude + ';' + options.location.longitude);
|
|
207
224
|
}
|
|
208
225
|
|
|
209
|
-
|
|
210
|
-
|
|
226
|
+
const trigger = this.getAlarm();
|
|
227
|
+
|
|
228
|
+
if (trigger) {
|
|
229
|
+
arr.push('BEGIN:VALARM', 'ACTION:DISPLAY', 'DESCRIPTION:Event reminder', `${trigger}`, 'END:VALARM');
|
|
211
230
|
}
|
|
212
231
|
|
|
213
232
|
arr.push('END:VEVENT');
|
|
@@ -377,6 +396,10 @@ function createMemo(e, options) {
|
|
|
377
396
|
const desc = e.getDesc();
|
|
378
397
|
const candles = desc === 'Havdalah' || desc === 'Candle lighting';
|
|
379
398
|
|
|
399
|
+
if (typeof e.memo === 'string' && e.memo.length && e.memo.indexOf('\n') !== -1) {
|
|
400
|
+
e.memo = e.memo.replace(/\n/g, '\\n');
|
|
401
|
+
}
|
|
402
|
+
|
|
380
403
|
if (candles) {
|
|
381
404
|
return e.memo || '';
|
|
382
405
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/*! @hebcal/icalendar v4.
|
|
2
|
-
import { flags, Locale } from '@hebcal/core';
|
|
1
|
+
/*! @hebcal/icalendar v4.17.1 */
|
|
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
|
+
const version="4.17.1";
|
|
8
8
|
|
|
9
9
|
const VTIMEZONE = {};
|
|
10
10
|
const CATEGORY = {
|
|
@@ -119,7 +119,11 @@ class IcalEvent {
|
|
|
119
119
|
const prefix = ev.getEmoji();
|
|
120
120
|
|
|
121
121
|
if (prefix) {
|
|
122
|
-
|
|
122
|
+
if (mask & flags.OMER_COUNT) {
|
|
123
|
+
subj = subj + ' ' + prefix;
|
|
124
|
+
} else {
|
|
125
|
+
subj = prefix + ' ' + subj;
|
|
126
|
+
}
|
|
123
127
|
}
|
|
124
128
|
} // make subject safe for iCalendar
|
|
125
129
|
|
|
@@ -135,19 +139,32 @@ class IcalEvent {
|
|
|
135
139
|
}
|
|
136
140
|
|
|
137
141
|
this.subj = subj;
|
|
138
|
-
|
|
142
|
+
this.category = ev.category || CATEGORY[getEventCategories(ev)[0]];
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* @return {string}
|
|
146
|
+
*/
|
|
139
147
|
|
|
140
|
-
|
|
141
|
-
|
|
148
|
+
|
|
149
|
+
getAlarm() {
|
|
150
|
+
const ev = this.ev;
|
|
151
|
+
const mask = ev.getFlags();
|
|
152
|
+
const evAlarm = ev.alarm;
|
|
153
|
+
|
|
154
|
+
if (typeof evAlarm === 'string') {
|
|
155
|
+
return 'TRIGGER:' + evAlarm;
|
|
156
|
+
} else if (greg.isDate(evAlarm)) {
|
|
157
|
+
evAlarm.setSeconds(0);
|
|
158
|
+
return 'TRIGGER;VALUE=DATE-TIME:' + IcalEvent.makeDtstamp(evAlarm);
|
|
142
159
|
} else if (mask & flags.OMER_COUNT) {
|
|
143
|
-
|
|
144
|
-
} else if (
|
|
145
|
-
|
|
146
|
-
} else if (timed && ev.getDesc().startsWith('Candle lighting')) {
|
|
147
|
-
|
|
160
|
+
return 'TRIGGER:-P0DT3H30M0S'; // 8:30pm Omer alarm evening before
|
|
161
|
+
} else if (mask & flags.USER_EVENT) {
|
|
162
|
+
return 'TRIGGER:-P0DT12H0M0S'; // noon the day before
|
|
163
|
+
} else if (this.timed && ev.getDesc().startsWith('Candle lighting')) {
|
|
164
|
+
return 'TRIGGER:-P0DT0H10M0S';
|
|
148
165
|
}
|
|
149
166
|
|
|
150
|
-
|
|
167
|
+
return null;
|
|
151
168
|
}
|
|
152
169
|
/**
|
|
153
170
|
* @return {string}
|
|
@@ -202,8 +219,10 @@ class IcalEvent {
|
|
|
202
219
|
arr.push('GEO:' + options.location.latitude + ';' + options.location.longitude);
|
|
203
220
|
}
|
|
204
221
|
|
|
205
|
-
|
|
206
|
-
|
|
222
|
+
const trigger = this.getAlarm();
|
|
223
|
+
|
|
224
|
+
if (trigger) {
|
|
225
|
+
arr.push('BEGIN:VALARM', 'ACTION:DISPLAY', 'DESCRIPTION:Event reminder', `${trigger}`, 'END:VALARM');
|
|
207
226
|
}
|
|
208
227
|
|
|
209
228
|
arr.push('END:VEVENT');
|
|
@@ -373,6 +392,10 @@ function createMemo(e, options) {
|
|
|
373
392
|
const desc = e.getDesc();
|
|
374
393
|
const candles = desc === 'Havdalah' || desc === 'Candle lighting';
|
|
375
394
|
|
|
395
|
+
if (typeof e.memo === 'string' && e.memo.length && e.memo.indexOf('\n') !== -1) {
|
|
396
|
+
e.memo = e.memo.replace(/\n/g, '\\n');
|
|
397
|
+
}
|
|
398
|
+
|
|
376
399
|
if (candles) {
|
|
377
400
|
return e.memo || '';
|
|
378
401
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hebcal/icalendar",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.17.1",
|
|
4
4
|
"author": "Michael J. Radwin (https://github.com/mjradwin)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ical",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"url": "https://github.com/hebcal/hebcal-icalendar/issues"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@hebcal/core": "^3.
|
|
27
|
+
"@hebcal/core": "^3.36.0",
|
|
28
28
|
"@hebcal/rest-api": "^3.13.0",
|
|
29
29
|
"murmurhash3": "^0.5.0"
|
|
30
30
|
},
|
|
@@ -48,18 +48,18 @@
|
|
|
48
48
|
"verbose": true
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@babel/core": "^7.17.
|
|
51
|
+
"@babel/core": "^7.17.9",
|
|
52
52
|
"@babel/preset-env": "^7.16.11",
|
|
53
|
-
"@babel/register": "^7.17.
|
|
53
|
+
"@babel/register": "^7.17.7",
|
|
54
54
|
"@rollup/plugin-babel": "^5.3.1",
|
|
55
|
-
"@rollup/plugin-commonjs": "^
|
|
55
|
+
"@rollup/plugin-commonjs": "^22.0.0",
|
|
56
56
|
"@rollup/plugin-json": "^4.1.0",
|
|
57
|
-
"@rollup/plugin-node-resolve": "^13.1
|
|
58
|
-
"ava": "^4.
|
|
59
|
-
"eslint": "^8.
|
|
57
|
+
"@rollup/plugin-node-resolve": "^13.2.1",
|
|
58
|
+
"ava": "^4.2.0",
|
|
59
|
+
"eslint": "^8.14.0",
|
|
60
60
|
"eslint-config-google": "^0.14.0",
|
|
61
61
|
"jsdoc": "^3.6.10",
|
|
62
62
|
"jsdoc-to-markdown": "^7.1.1",
|
|
63
|
-
"rollup": "^2.70.
|
|
63
|
+
"rollup": "^2.70.2"
|
|
64
64
|
}
|
|
65
65
|
}
|