@hebcal/icalendar
Advanced tools
Comparing version 4.1.0 to 4.2.0
@@ -1,2 +0,2 @@ | ||
/*! @hebcal/icalendar v4.1.0 */ | ||
/*! @hebcal/icalendar v4.2.0 */ | ||
'use strict'; | ||
@@ -194,2 +194,79 @@ | ||
/** | ||
* Returns a category and subcategory name | ||
* @param {Event} ev | ||
* @return {string[]} | ||
*/ | ||
function getEventCategories(ev) { | ||
const desc = ev.getDesc(); // since these use flags.MINOR_FAST or flags.MAJOR_FAST, check description first | ||
if (desc === 'Fast begins' || desc === 'Fast ends') { | ||
return ['zmanim', 'fast']; | ||
} | ||
switch (ev.getFlags()) { | ||
case core.flags.OMER_COUNT: | ||
return ['omer']; | ||
case core.flags.HEBREW_DATE: | ||
return ['hebdate']; | ||
case core.flags.PARSHA_HASHAVUA: | ||
return ['parashat']; | ||
// backwards-compat | ||
case core.flags.DAF_YOMI: | ||
return ['dafyomi']; | ||
case core.flags.ROSH_CHODESH: | ||
return ['roshchodesh']; | ||
case core.flags.SPECIAL_SHABBAT: | ||
return ['holiday', 'shabbat']; | ||
case core.flags.MINOR_FAST: | ||
return ['holiday', 'fast']; | ||
case core.flags.MAJOR_FAST: | ||
return ['holiday', 'fast', 'major']; | ||
case core.flags.MODERN_HOLIDAY: | ||
return ['holiday', 'modern']; | ||
case core.flags.SHABBAT_MEVARCHIM: | ||
return ['mevarchim']; | ||
case core.flags.MOLAD: | ||
return ['molad']; | ||
case core.flags.USER_EVENT: | ||
return ['user']; | ||
// fall through to string-based category | ||
} | ||
if (ev.cholHaMoedDay) { | ||
return ['holiday', 'major', 'cholhamoed']; | ||
} | ||
switch (desc) { | ||
case 'Havdalah': | ||
return ['havdalah']; | ||
case 'Candle lighting': | ||
return ['candles']; | ||
case 'Lag BaOmer': | ||
case 'Leil Selichot': | ||
case 'Pesach Sheni': | ||
case 'Purim Katan': | ||
case 'Shushan Purim': | ||
case 'Tu B\'Av': | ||
case 'Tu BiShvat': | ||
return ['holiday', 'minor']; | ||
default: | ||
return ['holiday', 'major']; | ||
} | ||
} | ||
/** | ||
* Generates a title like "Hebcal 2020 Israel" or "Hebcal May 1993 Providence" | ||
@@ -326,5 +403,19 @@ * @param {Event[]} events | ||
var version="4.1.0"; | ||
var version="4.2.0"; | ||
const VTIMEZONE = {}; | ||
const CATEGORY = { | ||
candles: 'Holiday', | ||
dafyomi: 'Daf Yomi', | ||
havdalah: 'Holiday', | ||
hebdate: null, | ||
holiday: 'Holiday', | ||
mevarchim: null, | ||
molad: null, | ||
omer: null, | ||
parashat: 'Parsha', | ||
roshchodesh: 'Holiday', | ||
user: 'Personal', | ||
zmanim: null | ||
}; | ||
/** | ||
@@ -474,4 +565,5 @@ * @private | ||
const isUserEvent = Boolean(mask & core.flags.USER_EVENT); | ||
const category = isUserEvent ? 'Personal' : 'Holiday'; | ||
const arr = ['BEGIN:VEVENT', `DTSTAMP:${dtstamp}`, `CATEGORIES:${category}`, `SUMMARY:${subj}`, `DTSTART${dtargs}:${startDate}`, `DTEND${dtargs}:${endDate}`, `TRANSP:${transp}`, `X-MICROSOFT-CDO-BUSYSTATUS:${busyStatus}`, `UID:${uid}`]; | ||
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}`]); | ||
@@ -478,0 +570,0 @@ if (!isUserEvent) { |
{ | ||
"name": "@hebcal/icalendar", | ||
"version": "4.1.0", | ||
"version": "4.2.0", | ||
"author": "Michael J. Radwin (https://github.com/mjradwin)", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
56024
1267