@hebcal/icalendar 6.3.0 → 6.3.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 CHANGED
@@ -1,13 +1,16 @@
1
- /*! @hebcal/icalendar v6.3.0 */
1
+ /*! @hebcal/icalendar v6.3.2 */
2
2
  import { flags, Locale, greg } from '@hebcal/core';
3
3
  import { murmur32HexSync } from 'murmurhash3';
4
4
  import { pad2, pad4 } from '@hebcal/hdate';
5
- import { shouldRenderBrief, getEventCategories, getCalendarTitle, getHolidayDescription, appendIsraelAndTracking, makeTorahMemoText } from '@hebcal/rest-api/dist/esm/common';
5
+ import { shouldRenderBrief, getEventCategories, getCalendarTitle } from '@hebcal/rest-api/dist/esm/common';
6
+ import { getHolidayDescription } from '@hebcal/rest-api/dist/esm/holiday';
7
+ import { makeTorahMemoText } from '@hebcal/rest-api/dist/esm/memo';
8
+ import { appendIsraelAndTracking } from '@hebcal/rest-api/dist/esm/url';
6
9
  import { makeAnchor } from '@hebcal/rest-api/dist/esm/makeAnchor';
7
10
  import { promises } from 'fs';
8
11
 
9
12
  // DO NOT EDIT THIS AUTO-GENERATED FILE!
10
- const version = '6.3.0';
13
+ const version = '6.3.2';
11
14
 
12
15
  const vtimezoneCache = new Map();
13
16
  const CATEGORY = {
@@ -74,35 +77,37 @@ class IcalEvent {
74
77
  const opts = Object.assign({}, options);
75
78
  this.options = opts;
76
79
  this.dtstamp = opts.dtstamp || IcalEvent.makeDtstamp(new Date());
77
- if (typeof ev.sequence === 'number') {
78
- this.sequence = ev.sequence;
80
+ const ev0 = ev;
81
+ if (typeof ev0.sequence === 'number') {
82
+ this.sequence = ev0.sequence;
79
83
  }
80
84
  else if (typeof opts.sequence === 'number') {
81
85
  this.sequence = opts.sequence;
82
86
  }
83
- const timed = (this.timed = Boolean(ev.eventTime));
87
+ const timed = (this.timed = Boolean(ev0.eventTime));
84
88
  const locale = opts.locale;
85
89
  const location = opts.location;
86
90
  let subj = shouldRenderBrief(ev)
87
91
  ? ev.renderBrief(locale)
88
92
  : ev.render(locale);
89
93
  const mask = ev.getFlags();
90
- if (ev.locationName) {
91
- this.locationName = ev.locationName;
94
+ if (ev0.locationName) {
95
+ this.locationName = ev0.locationName;
92
96
  }
93
97
  else if (timed && location) {
94
98
  this.locationName = location.getShortName();
95
99
  }
96
- else if (mask & DAILY_LEARNING && ev.category) {
97
- this.locationName = Locale.gettext(ev.category, locale);
100
+ else if (mask & DAILY_LEARNING && ev0.category) {
101
+ this.locationName = Locale.gettext(ev0.category, locale);
98
102
  }
99
- const date = IcalEvent.formatYYYYMMDD(ev.getDate().greg());
103
+ const hd = ev.getDate();
104
+ const date = IcalEvent.formatYYYYMMDD(hd.greg());
100
105
  this.startDate = this.isoDateOnly = date;
101
106
  this.dtargs = '';
102
107
  this.transp = 'TRANSPARENT';
103
108
  this.busyStatus = 'FREE';
104
109
  if (timed) {
105
- let [hour, minute] = ev.eventTimeStr.split(':');
110
+ let [hour, minute] = ev0.eventTimeStr.split(':');
106
111
  hour = +hour;
107
112
  minute = +minute;
108
113
  this.startDate += 'T' + pad2(hour) + pad2(minute) + '00';
@@ -112,7 +117,7 @@ class IcalEvent {
112
117
  }
113
118
  }
114
119
  else {
115
- this.endDate = IcalEvent.formatYYYYMMDD(ev.getDate().next().greg());
120
+ this.endDate = IcalEvent.formatYYYYMMDD(hd.next().greg());
116
121
  // for all-day untimed, use DTEND;VALUE=DATE intsead of DURATION:P1D.
117
122
  // It's more compatible with everthing except ancient versions of
118
123
  // Lotus Notes circa 2004
@@ -142,8 +147,7 @@ class IcalEvent {
142
147
  }
143
148
  }
144
149
  this.subj = subj;
145
- this.category =
146
- ev.category || CATEGORY[(_a = getEventCategories(ev)) === null || _a === void 0 ? void 0 : _a[0]];
150
+ this.category = ev0.category || CATEGORY[(_a = getEventCategories(ev)) === null || _a === void 0 ? void 0 : _a[0]];
147
151
  }
148
152
  getAlarm() {
149
153
  const ev = this.ev;
@@ -424,6 +428,15 @@ async function eventsToIcalendar(events, options) {
424
428
  const icals = events.map(ev => new IcalEvent(ev, opts));
425
429
  return icalEventsToString(icals, opts);
426
430
  }
431
+ const localeMap = {
432
+ 'he-x-NoNikud': 'he',
433
+ 'he-x-nonikud': 'he',
434
+ h: 'he',
435
+ a: 'en',
436
+ s: 'en',
437
+ ashkenazi: 'en',
438
+ ashkenazi_romanian: 'ro',
439
+ };
427
440
  /**
428
441
  * Generates an RFC 2445 iCalendar string from an array of IcalEvents
429
442
  */
@@ -434,7 +447,8 @@ async function icalEventsToString(icals, options) {
434
447
  throw new TypeError('Invalid options object');
435
448
  const stream = [];
436
449
  const locale = options.locale || 'en';
437
- const uclang = locale.toUpperCase();
450
+ const lang = locale.length === 2 ? locale : localeMap[locale] || 'en';
451
+ const uclang = lang.toUpperCase();
438
452
  const opts = Object.assign({}, options);
439
453
  opts.dtstamp = opts.dtstamp || IcalEvent.makeDtstamp(new Date());
440
454
  const title = opts.title ? IcalEvent.escape(opts.title) : 'Untitled';
@@ -1 +1 @@
1
- export declare const version = "6.3.0";
1
+ export declare const version = "6.3.2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hebcal/icalendar",
3
- "version": "6.3.0",
3
+ "version": "6.3.2",
4
4
  "author": "Michael J. Radwin (https://github.com/mjradwin)",
5
5
  "keywords": [
6
6
  "ical",
@@ -30,9 +30,9 @@
30
30
  },
31
31
  "homepage": "https://hebcal.github.io/api/icalendar/",
32
32
  "dependencies": {
33
- "@hebcal/core": "^6.0.0",
34
- "@hebcal/hdate": "^0.21.0",
35
- "@hebcal/rest-api": "^6.2.0",
33
+ "@hebcal/core": "^6.0.6",
34
+ "@hebcal/hdate": "^0.21.1",
35
+ "@hebcal/rest-api": "^6.4.0",
36
36
  "murmurhash3": "^0.5.0",
37
37
  "tslib": "^2.8.1"
38
38
  },
@@ -53,12 +53,11 @@
53
53
  "devDependencies": {
54
54
  "@hebcal/learning": "^6.6.0",
55
55
  "@rollup/plugin-typescript": "^12.3.0",
56
- "@types/jest": "^30.0.0",
57
- "@types/node": "24.9.1",
56
+ "@types/node": "24.9.2",
58
57
  "gts": "^5.3.1",
59
- "rollup": "^4.52.5",
60
- "typedoc": "^0.28.14",
58
+ "rollup": "^4.53.3",
59
+ "typedoc": "^0.28.15",
61
60
  "typescript": "^5.9.3",
62
- "vitest": "^4.0.3"
61
+ "vitest": "^4.0.15"
63
62
  }
64
63
  }