Socket
Socket
Sign inDemoInstall

@hebcal/icalendar

Package Overview
Dependencies
Maintainers
1
Versions
92
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hebcal/icalendar - npm Package Compare versions

Comparing version 4.6.1 to 4.7.0

108

dist/index.js

@@ -1,2 +0,2 @@

/*! @hebcal/icalendar v4.6.1 */
/*! @hebcal/icalendar v4.7.0 */
'use strict';

@@ -448,3 +448,3 @@

var version="4.6.1";
var version="4.7.0";

@@ -503,25 +503,24 @@ const VTIMEZONE = {};

constructor(ev, options = {}) {
const dtstamp = options.dtstamp || IcalEvent.makeDtstamp(new Date());
const timed = Boolean(ev.eventTime);
this.ev = ev;
this.options = options;
this.dtstamp = options.dtstamp || IcalEvent.makeDtstamp(new Date());
const timed = this.timed = Boolean(ev.eventTime);
let subj = timed || ev.getFlags() & core.flags.DAF_YOMI ? ev.renderBrief() : ev.render();
const desc = ev.getDesc(); // original untranslated
const mask = ev.getFlags();
let location;
if (timed && options.location && options.location.name) {
const comma = options.location.name.indexOf(',');
location = comma == -1 ? options.location.name : options.location.name.substring(0, comma);
this.locationName = comma == -1 ? options.location.name : options.location.name.substring(0, comma);
}
const mask = ev.getFlags();
if (mask & core.flags.DAF_YOMI) {
location = core.Locale.gettext('Daf Yomi');
this.locationName = core.Locale.gettext('Daf Yomi');
}
const date = IcalEvent.formatYYYYMMDD(ev.getDate().greg());
let startDate = date;
let dtargs = '';
let endDate;
let transp = 'TRANSPARENT';
let busyStatus = 'FREE';
this.startDate = date;
this.dtargs = '';
this.transp = 'TRANSPARENT';
this.busyStatus = 'FREE';

@@ -532,18 +531,18 @@ if (timed) {

minute = +minute;
startDate += 'T' + pad2(hour) + pad2(minute) + '00';
endDate = startDate;
this.startDate += 'T' + pad2(hour) + pad2(minute) + '00';
this.endDate = this.startDate;
if (options.location && options.location.tzid) {
dtargs = `;TZID=${options.location.tzid}`;
this.dtargs = `;TZID=${options.location.tzid}`;
}
} else {
endDate = IcalEvent.formatYYYYMMDD(ev.getDate().next().greg()); // for all-day untimed, use DTEND;VALUE=DATE intsead of DURATION:P1D.
this.endDate = IcalEvent.formatYYYYMMDD(ev.getDate().next().greg()); // for all-day untimed, use DTEND;VALUE=DATE intsead of DURATION:P1D.
// It's more compatible with everthing except ancient versions of
// Lotus Notes circa 2004
dtargs = ';VALUE=DATE';
this.dtargs = ';VALUE=DATE';
if (mask & core.flags.CHAG) {
transp = 'OPAQUE';
busyStatus = 'OOF';
this.transp = 'OPAQUE';
this.busyStatus = 'OOF';
}

@@ -555,3 +554,3 @@ }

if (!uid) {
const digest = murmur3_1(desc).toString(16);
const digest = murmur3_1(ev.getDesc()).toString(16);
uid = `hebcal-${date}-${digest}`;

@@ -566,4 +565,5 @@

}
} // make subject safe for iCalendar
}
this.uid = uid; // make subject safe for iCalendar

@@ -580,38 +580,48 @@ subj = IcalEvent.escape(subj);

this.subj = subj;
const isUserEvent = Boolean(mask & core.flags.USER_EVENT);
const category = CATEGORY[getEventCategories(ev)[0]];
const categoryLine = category ? `CATEGORIES:${category}` : [];
const arr = ['BEGIN:VEVENT', `DTSTAMP:${dtstamp}`].concat(categoryLine).concat([`SUMMARY:${subj}`, `DTSTART${dtargs}:${startDate}`, `DTEND${dtargs}:${endDate}`, `TRANSP:${transp}`, `X-MICROSOFT-CDO-BUSYSTATUS:${busyStatus}`, `UID:${uid}`]);
if (mask & core.flags.OMER_COUNT) {
this.alarm = '0DT3H30M0S'; // 8:30pm Omer alarm evening before
} else if (isUserEvent) {
this.alarm = '0DT12H0M0S'; // noon the day before
} else if (timed && ev.getDesc().startsWith('Candle lighting')) {
this.alarm = '0DT0H10M0S'; // ten minutes
}
this.category = CATEGORY[getEventCategories(ev)[0]];
}
/**
* @return {string[]}
*/
getLongLines() {
if (this.lines) return this.lines;
const categoryLine = this.category ? `CATEGORIES:${this.category}` : [];
const arr = this.lines = ['BEGIN:VEVENT', `DTSTAMP:${this.dtstamp}`].concat(categoryLine).concat([`SUMMARY:${this.subj}`, `DTSTART${this.dtargs}:${this.startDate}`, `DTEND${this.dtargs}:${this.endDate}`, `TRANSP:${this.transp}`, `X-MICROSOFT-CDO-BUSYSTATUS:${this.busyStatus}`, `UID:${this.uid}`]);
const ev = this.ev;
const mask = ev.getFlags();
const isUserEvent = Boolean(mask & core.flags.USER_EVENT);
if (!isUserEvent) {
arr.push('CLASS:PUBLIC');
} // create memo (holiday descr, Torah, etc)
}
const options = this.options; // create memo (holiday descr, Torah, etc)
const memo = createMemo(ev, options.il);
addOptional(arr, 'DESCRIPTION', memo);
addOptional(arr, 'LOCATION', location);
addOptional(arr, 'LOCATION', this.locationName);
if (timed && options.location) {
if (this.timed && options.location) {
arr.push('GEO:' + options.location.latitude + ';' + options.location.longitude);
}
let alarm;
if (mask & core.flags.OMER_COUNT) {
alarm = '0DT3H30M0S'; // 8:30pm Omer alarm evening before
} else if (isUserEvent) {
alarm = '0DT12H0M0S'; // noon the day before
} else if (timed && desc.startsWith('Candle lighting')) {
alarm = '0DT0H10M0S'; // ten minutes
if (this.alarm) {
arr.push('BEGIN:VALARM', 'ACTION:DISPLAY', 'DESCRIPTION:This is an event reminder', `TRIGGER:-P${this.alarm}`, 'END:VALARM');
}
if (alarm) {
arr.push('BEGIN:VALARM', 'ACTION:DISPLAY', 'DESCRIPTION:This is an event reminder', `TRIGGER:-P${alarm}`, 'END:VALARM');
}
arr.push('END:VEVENT');
this.lines = arr;
this.options = options;
this.ev = ev;
return arr;
}

@@ -636,10 +646,2 @@ /**

/**
* @return {string[]}
*/
getLongLines() {
return this.lines;
}
/**
* fold line to 75 characters

@@ -646,0 +648,0 @@ * @param {string} line

{
"name": "@hebcal/icalendar",
"version": "4.6.1",
"version": "4.7.0",
"author": "Michael J. Radwin (https://github.com/mjradwin)",

@@ -27,3 +27,3 @@ "keywords": [

"dependencies": {
"@hebcal/core": "^3.17.5",
"@hebcal/core": "^3.18.0",
"@hebcal/rest-api": "^3.6.0"

@@ -61,3 +61,3 @@ },

"@babel/polyfill": "^7.12.1",
"@babel/preset-env": "^7.14.5",
"@babel/preset-env": "^7.14.7",
"@babel/register": "^7.14.5",

@@ -64,0 +64,0 @@ "@rollup/plugin-babel": "^5.3.0",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc