@hebcal/icalendar 4.22.0 → 5.0.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 CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/icalendar v4.22.0 */
1
+ /*! @hebcal/icalendar v5.0.0 */
2
2
  'use strict';
3
3
 
4
4
  var core = require('@hebcal/core');
@@ -6,7 +6,7 @@ var murmurhash3 = require('murmurhash3');
6
6
  var restApi = require('@hebcal/rest-api');
7
7
  var fs = require('fs');
8
8
 
9
- const version="4.22.0";
9
+ const version="5.0.0";
10
10
 
11
11
  const VTIMEZONE = {};
12
12
  const CATEGORY = {
@@ -90,9 +90,8 @@ class IcalEvent {
90
90
  this.locationName = core.Locale.gettext('Nach Yomi');
91
91
  } else if (mask & core.flags.MISHNA_YOMI) {
92
92
  this.locationName = core.Locale.gettext('Mishna Yomi');
93
- } else if (timed && options.location?.name) {
94
- const comma = options.location.name.indexOf(',');
95
- this.locationName = comma == -1 ? options.location.name : options.location.name.substring(0, comma);
93
+ } else if (timed && options.location) {
94
+ this.locationName = options.location.getShortName();
96
95
  }
97
96
  const date = IcalEvent.formatYYYYMMDD(ev.getDate().greg());
98
97
  this.startDate = date;
@@ -105,8 +104,8 @@ class IcalEvent {
105
104
  minute = +minute;
106
105
  this.startDate += 'T' + restApi.pad2(hour) + restApi.pad2(minute) + '00';
107
106
  this.endDate = this.startDate;
108
- if (options.location?.tzid) {
109
- this.dtargs = `;TZID=${options.location.tzid}`;
107
+ if (options.location?.getTzid()) {
108
+ this.dtargs = `;TZID=${options.location.getTzid()}`;
110
109
  }
111
110
  } else {
112
111
  this.endDate = IcalEvent.formatYYYYMMDD(ev.getDate().next().greg());
@@ -174,10 +173,11 @@ class IcalEvent {
174
173
  const digest = murmurhash3.murmur32HexSync(this.ev.getDesc());
175
174
  let uid = `hebcal-${this.startDate}-${digest}`;
176
175
  if (this.timed && options.location) {
177
- if (options.location.geoid) {
178
- uid += `-${options.location.geoid}`;
179
- } else if (options.location.name) {
180
- uid += '-' + restApi.makeAnchor(options.location.name);
176
+ const loc = options.location;
177
+ if (loc.getGeoId()) {
178
+ uid += `-${loc.getGeoId()}`;
179
+ } else if (loc.getName()) {
180
+ uid += '-' + restApi.makeAnchor(loc.getName());
181
181
  }
182
182
  }
183
183
  return uid;
@@ -209,7 +209,7 @@ class IcalEvent {
209
209
  addOptional(arr, 'DESCRIPTION', memo);
210
210
  addOptional(arr, 'LOCATION', this.locationName);
211
211
  if (this.timed && options.location) {
212
- arr.push('GEO:' + options.location.latitude + ';' + options.location.longitude);
212
+ arr.push('GEO:' + options.location.getLatitude() + ';' + options.location.getLongitude());
213
213
  }
214
214
  const trigger = this.getAlarm();
215
215
  if (trigger) {
@@ -446,8 +446,8 @@ async function icalEventsToString(icals, options) {
446
446
  stream.push(`X-APPLE-CALENDAR-COLOR:${opts.calendarColor}\r\n`);
447
447
  }
448
448
  const location = opts.location;
449
- if (location?.tzid) {
450
- const tzid = location.tzid;
449
+ const tzid = location?.getTzid();
450
+ if (tzid) {
451
451
  stream.push(`X-WR-TIMEZONE;VALUE=TEXT:${tzid}\r\n`);
452
452
  if (VTIMEZONE[tzid]) {
453
453
  stream.push(VTIMEZONE[tzid]);
package/dist/index.mjs CHANGED
@@ -1,10 +1,10 @@
1
- /*! @hebcal/icalendar v4.22.0 */
1
+ /*! @hebcal/icalendar v5.0.0 */
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
- const version="4.22.0";
7
+ const version="5.0.0";
8
8
 
9
9
  const VTIMEZONE = {};
10
10
  const CATEGORY = {
@@ -88,9 +88,8 @@ class IcalEvent {
88
88
  this.locationName = Locale.gettext('Nach Yomi');
89
89
  } else if (mask & flags.MISHNA_YOMI) {
90
90
  this.locationName = Locale.gettext('Mishna Yomi');
91
- } else if (timed && options.location?.name) {
92
- const comma = options.location.name.indexOf(',');
93
- this.locationName = comma == -1 ? options.location.name : options.location.name.substring(0, comma);
91
+ } else if (timed && options.location) {
92
+ this.locationName = options.location.getShortName();
94
93
  }
95
94
  const date = IcalEvent.formatYYYYMMDD(ev.getDate().greg());
96
95
  this.startDate = date;
@@ -103,8 +102,8 @@ class IcalEvent {
103
102
  minute = +minute;
104
103
  this.startDate += 'T' + pad2(hour) + pad2(minute) + '00';
105
104
  this.endDate = this.startDate;
106
- if (options.location?.tzid) {
107
- this.dtargs = `;TZID=${options.location.tzid}`;
105
+ if (options.location?.getTzid()) {
106
+ this.dtargs = `;TZID=${options.location.getTzid()}`;
108
107
  }
109
108
  } else {
110
109
  this.endDate = IcalEvent.formatYYYYMMDD(ev.getDate().next().greg());
@@ -172,10 +171,11 @@ class IcalEvent {
172
171
  const digest = murmur32HexSync(this.ev.getDesc());
173
172
  let uid = `hebcal-${this.startDate}-${digest}`;
174
173
  if (this.timed && options.location) {
175
- if (options.location.geoid) {
176
- uid += `-${options.location.geoid}`;
177
- } else if (options.location.name) {
178
- uid += '-' + makeAnchor(options.location.name);
174
+ const loc = options.location;
175
+ if (loc.getGeoId()) {
176
+ uid += `-${loc.getGeoId()}`;
177
+ } else if (loc.getName()) {
178
+ uid += '-' + makeAnchor(loc.getName());
179
179
  }
180
180
  }
181
181
  return uid;
@@ -207,7 +207,7 @@ class IcalEvent {
207
207
  addOptional(arr, 'DESCRIPTION', memo);
208
208
  addOptional(arr, 'LOCATION', this.locationName);
209
209
  if (this.timed && options.location) {
210
- arr.push('GEO:' + options.location.latitude + ';' + options.location.longitude);
210
+ arr.push('GEO:' + options.location.getLatitude() + ';' + options.location.getLongitude());
211
211
  }
212
212
  const trigger = this.getAlarm();
213
213
  if (trigger) {
@@ -444,8 +444,8 @@ async function icalEventsToString(icals, options) {
444
444
  stream.push(`X-APPLE-CALENDAR-COLOR:${opts.calendarColor}\r\n`);
445
445
  }
446
446
  const location = opts.location;
447
- if (location?.tzid) {
448
- const tzid = location.tzid;
447
+ const tzid = location?.getTzid();
448
+ if (tzid) {
449
449
  stream.push(`X-WR-TIMEZONE;VALUE=TEXT:${tzid}\r\n`);
450
450
  if (VTIMEZONE[tzid]) {
451
451
  stream.push(VTIMEZONE[tzid]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hebcal/icalendar",
3
- "version": "4.22.0",
3
+ "version": "5.0.0",
4
4
  "author": "Michael J. Radwin (https://github.com/mjradwin)",
5
5
  "keywords": [
6
6
  "ical",
@@ -24,8 +24,8 @@
24
24
  "url": "https://github.com/hebcal/hebcal-icalendar/issues"
25
25
  },
26
26
  "dependencies": {
27
- "@hebcal/core": "^4.4.1",
28
- "@hebcal/rest-api": "^4.5.7",
27
+ "@hebcal/core": "^5.0.0-rc2",
28
+ "@hebcal/rest-api": "^5.0.0",
29
29
  "murmurhash3": "^0.5.0"
30
30
  },
31
31
  "scripts": {
@@ -42,18 +42,18 @@
42
42
  ]
43
43
  },
44
44
  "devDependencies": {
45
- "@babel/core": "^7.23.2",
46
- "@babel/preset-env": "^7.23.2",
45
+ "@babel/core": "^7.23.3",
46
+ "@babel/preset-env": "^7.23.3",
47
47
  "@babel/register": "^7.22.15",
48
- "@hebcal/learning": "^1.5.2",
48
+ "@hebcal/learning": "^5.0.0",
49
49
  "@rollup/plugin-babel": "^6.0.4",
50
50
  "@rollup/plugin-commonjs": "^25.0.7",
51
51
  "@rollup/plugin-json": "^6.0.1",
52
52
  "ava": "^5.3.1",
53
- "eslint": "^8.51.0",
53
+ "eslint": "^8.54.0",
54
54
  "eslint-config-google": "^0.14.0",
55
55
  "jsdoc": "^4.0.2",
56
56
  "jsdoc-to-markdown": "^8.0.0",
57
- "rollup": "^4.1.4"
57
+ "rollup": "^4.5.1"
58
58
  }
59
59
  }