@hebcal/icalendar 6.3.0 → 6.3.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 CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/icalendar v6.3.0 */
1
+ /*! @hebcal/icalendar v6.3.1 */
2
2
  import { flags, Locale, greg } from '@hebcal/core';
3
3
  import { murmur32HexSync } from 'murmurhash3';
4
4
  import { pad2, pad4 } from '@hebcal/hdate';
@@ -7,7 +7,7 @@ import { makeAnchor } from '@hebcal/rest-api/dist/esm/makeAnchor';
7
7
  import { promises } from 'fs';
8
8
 
9
9
  // DO NOT EDIT THIS AUTO-GENERATED FILE!
10
- const version = '6.3.0';
10
+ const version = '6.3.1';
11
11
 
12
12
  const vtimezoneCache = new Map();
13
13
  const CATEGORY = {
@@ -74,35 +74,37 @@ class IcalEvent {
74
74
  const opts = Object.assign({}, options);
75
75
  this.options = opts;
76
76
  this.dtstamp = opts.dtstamp || IcalEvent.makeDtstamp(new Date());
77
- if (typeof ev.sequence === 'number') {
78
- this.sequence = ev.sequence;
77
+ const ev0 = ev;
78
+ if (typeof ev0.sequence === 'number') {
79
+ this.sequence = ev0.sequence;
79
80
  }
80
81
  else if (typeof opts.sequence === 'number') {
81
82
  this.sequence = opts.sequence;
82
83
  }
83
- const timed = (this.timed = Boolean(ev.eventTime));
84
+ const timed = (this.timed = Boolean(ev0.eventTime));
84
85
  const locale = opts.locale;
85
86
  const location = opts.location;
86
87
  let subj = shouldRenderBrief(ev)
87
88
  ? ev.renderBrief(locale)
88
89
  : ev.render(locale);
89
90
  const mask = ev.getFlags();
90
- if (ev.locationName) {
91
- this.locationName = ev.locationName;
91
+ if (ev0.locationName) {
92
+ this.locationName = ev0.locationName;
92
93
  }
93
94
  else if (timed && location) {
94
95
  this.locationName = location.getShortName();
95
96
  }
96
- else if (mask & DAILY_LEARNING && ev.category) {
97
- this.locationName = Locale.gettext(ev.category, locale);
97
+ else if (mask & DAILY_LEARNING && ev0.category) {
98
+ this.locationName = Locale.gettext(ev0.category, locale);
98
99
  }
99
- const date = IcalEvent.formatYYYYMMDD(ev.getDate().greg());
100
+ const hd = ev.getDate();
101
+ const date = IcalEvent.formatYYYYMMDD(hd.greg());
100
102
  this.startDate = this.isoDateOnly = date;
101
103
  this.dtargs = '';
102
104
  this.transp = 'TRANSPARENT';
103
105
  this.busyStatus = 'FREE';
104
106
  if (timed) {
105
- let [hour, minute] = ev.eventTimeStr.split(':');
107
+ let [hour, minute] = ev0.eventTimeStr.split(':');
106
108
  hour = +hour;
107
109
  minute = +minute;
108
110
  this.startDate += 'T' + pad2(hour) + pad2(minute) + '00';
@@ -112,7 +114,7 @@ class IcalEvent {
112
114
  }
113
115
  }
114
116
  else {
115
- this.endDate = IcalEvent.formatYYYYMMDD(ev.getDate().next().greg());
117
+ this.endDate = IcalEvent.formatYYYYMMDD(hd.next().greg());
116
118
  // for all-day untimed, use DTEND;VALUE=DATE intsead of DURATION:P1D.
117
119
  // It's more compatible with everthing except ancient versions of
118
120
  // Lotus Notes circa 2004
@@ -142,8 +144,7 @@ class IcalEvent {
142
144
  }
143
145
  }
144
146
  this.subj = subj;
145
- this.category =
146
- ev.category || CATEGORY[(_a = getEventCategories(ev)) === null || _a === void 0 ? void 0 : _a[0]];
147
+ this.category = ev0.category || CATEGORY[(_a = getEventCategories(ev)) === null || _a === void 0 ? void 0 : _a[0]];
147
148
  }
148
149
  getAlarm() {
149
150
  const ev = this.ev;
@@ -424,6 +425,15 @@ async function eventsToIcalendar(events, options) {
424
425
  const icals = events.map(ev => new IcalEvent(ev, opts));
425
426
  return icalEventsToString(icals, opts);
426
427
  }
428
+ const localeMap = {
429
+ 'he-x-NoNikud': 'he',
430
+ 'he-x-nonikud': 'he',
431
+ h: 'he',
432
+ a: 'en',
433
+ s: 'en',
434
+ ashkenazi: 'en',
435
+ ashkenazi_romanian: 'ro',
436
+ };
427
437
  /**
428
438
  * Generates an RFC 2445 iCalendar string from an array of IcalEvents
429
439
  */
@@ -434,7 +444,8 @@ async function icalEventsToString(icals, options) {
434
444
  throw new TypeError('Invalid options object');
435
445
  const stream = [];
436
446
  const locale = options.locale || 'en';
437
- const uclang = locale.toUpperCase();
447
+ const lang = locale.length === 2 ? locale : localeMap[locale] || 'en';
448
+ const uclang = lang.toUpperCase();
438
449
  const opts = Object.assign({}, options);
439
450
  opts.dtstamp = opts.dtstamp || IcalEvent.makeDtstamp(new Date());
440
451
  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.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hebcal/icalendar",
3
- "version": "6.3.0",
3
+ "version": "6.3.1",
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.5",
34
+ "@hebcal/hdate": "^0.21.1",
35
+ "@hebcal/rest-api": "^6.3.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
58
  "rollup": "^4.52.5",
60
59
  "typedoc": "^0.28.14",
61
60
  "typescript": "^5.9.3",
62
- "vitest": "^4.0.3"
61
+ "vitest": "^4.0.6"
63
62
  }
64
63
  }