@hebcal/icalendar 4.16.0 → 4.17.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/index.js +28 -13
- package/dist/index.mjs +29 -14
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/icalendar v4.
|
|
1
|
+
/*! @hebcal/icalendar v4.17.0 */
|
|
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
|
-
const version="4.
|
|
11
|
+
const version="4.17.0";
|
|
12
12
|
|
|
13
13
|
const VTIMEZONE = {};
|
|
14
14
|
const CATEGORY = {
|
|
@@ -139,19 +139,32 @@ class IcalEvent {
|
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
this.subj = subj;
|
|
142
|
-
|
|
142
|
+
this.category = ev.category || CATEGORY[restApi.getEventCategories(ev)[0]];
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* @return {string}
|
|
146
|
+
*/
|
|
147
|
+
|
|
143
148
|
|
|
144
|
-
|
|
145
|
-
|
|
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 (core.greg.isDate(evAlarm)) {
|
|
157
|
+
evAlarm.setSeconds(0);
|
|
158
|
+
return 'TRIGGER;VALUE=DATE-TIME:' + IcalEvent.makeDtstamp(evAlarm);
|
|
146
159
|
} else if (mask & core.flags.OMER_COUNT) {
|
|
147
|
-
|
|
148
|
-
} else if (
|
|
149
|
-
|
|
150
|
-
} else if (timed && ev.getDesc().startsWith('Candle lighting')) {
|
|
151
|
-
|
|
160
|
+
return 'TRIGGER:-P0DT3H30M0S'; // 8:30pm Omer alarm evening before
|
|
161
|
+
} else if (mask & core.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';
|
|
152
165
|
}
|
|
153
166
|
|
|
154
|
-
|
|
167
|
+
return null;
|
|
155
168
|
}
|
|
156
169
|
/**
|
|
157
170
|
* @return {string}
|
|
@@ -206,8 +219,10 @@ class IcalEvent {
|
|
|
206
219
|
arr.push('GEO:' + options.location.latitude + ';' + options.location.longitude);
|
|
207
220
|
}
|
|
208
221
|
|
|
209
|
-
|
|
210
|
-
|
|
222
|
+
const trigger = this.getAlarm();
|
|
223
|
+
|
|
224
|
+
if (trigger) {
|
|
225
|
+
arr.push('BEGIN:VALARM', 'ACTION:DISPLAY', 'DESCRIPTION:Event reminder', `${trigger}`, 'END:VALARM');
|
|
211
226
|
}
|
|
212
227
|
|
|
213
228
|
arr.push('END:VEVENT');
|
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.0 */
|
|
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
|
-
const version="4.
|
|
7
|
+
const version="4.17.0";
|
|
8
8
|
|
|
9
9
|
const VTIMEZONE = {};
|
|
10
10
|
const CATEGORY = {
|
|
@@ -135,19 +135,32 @@ class IcalEvent {
|
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
this.subj = subj;
|
|
138
|
-
|
|
138
|
+
this.category = ev.category || CATEGORY[getEventCategories(ev)[0]];
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* @return {string}
|
|
142
|
+
*/
|
|
143
|
+
|
|
139
144
|
|
|
140
|
-
|
|
141
|
-
|
|
145
|
+
getAlarm() {
|
|
146
|
+
const ev = this.ev;
|
|
147
|
+
const mask = ev.getFlags();
|
|
148
|
+
const evAlarm = ev.alarm;
|
|
149
|
+
|
|
150
|
+
if (typeof evAlarm === 'string') {
|
|
151
|
+
return 'TRIGGER:' + evAlarm;
|
|
152
|
+
} else if (greg.isDate(evAlarm)) {
|
|
153
|
+
evAlarm.setSeconds(0);
|
|
154
|
+
return 'TRIGGER;VALUE=DATE-TIME:' + IcalEvent.makeDtstamp(evAlarm);
|
|
142
155
|
} else if (mask & flags.OMER_COUNT) {
|
|
143
|
-
|
|
144
|
-
} else if (
|
|
145
|
-
|
|
146
|
-
} else if (timed && ev.getDesc().startsWith('Candle lighting')) {
|
|
147
|
-
|
|
156
|
+
return 'TRIGGER:-P0DT3H30M0S'; // 8:30pm Omer alarm evening before
|
|
157
|
+
} else if (mask & flags.USER_EVENT) {
|
|
158
|
+
return 'TRIGGER:-P0DT12H0M0S'; // noon the day before
|
|
159
|
+
} else if (this.timed && ev.getDesc().startsWith('Candle lighting')) {
|
|
160
|
+
return 'TRIGGER:-P0DT0H10M0S';
|
|
148
161
|
}
|
|
149
162
|
|
|
150
|
-
|
|
163
|
+
return null;
|
|
151
164
|
}
|
|
152
165
|
/**
|
|
153
166
|
* @return {string}
|
|
@@ -202,8 +215,10 @@ class IcalEvent {
|
|
|
202
215
|
arr.push('GEO:' + options.location.latitude + ';' + options.location.longitude);
|
|
203
216
|
}
|
|
204
217
|
|
|
205
|
-
|
|
206
|
-
|
|
218
|
+
const trigger = this.getAlarm();
|
|
219
|
+
|
|
220
|
+
if (trigger) {
|
|
221
|
+
arr.push('BEGIN:VALARM', 'ACTION:DISPLAY', 'DESCRIPTION:Event reminder', `${trigger}`, 'END:VALARM');
|
|
207
222
|
}
|
|
208
223
|
|
|
209
224
|
arr.push('END:VEVENT');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hebcal/icalendar",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.17.0",
|
|
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
|
},
|