@hebcal/icalendar
Advanced tools
Comparing version 2.7.0 to 2.8.0
@@ -268,2 +268,32 @@ 'use strict'; | ||
/** | ||
* Renders the event title in default locale, but strips off time | ||
* @param {Event} ev | ||
* @return {string} | ||
*/ | ||
function renderTitleWithoutTime(ev) { | ||
const subj = ev.render(); | ||
if (ev.eventTime) { | ||
const desc = ev.getDesc(); | ||
switch (desc) { | ||
case 'Candle lighting': | ||
case 'Havdalah': | ||
case 'Fast begins': | ||
case 'Fast ends': | ||
// replace "Candle lighting: 15:34" with shorter title | ||
const colon = subj.indexOf(': '); | ||
if (colon !== -1) { | ||
return subj.substring(0, colon); | ||
} | ||
break; | ||
} | ||
} | ||
return subj; | ||
} | ||
/** | ||
* Generates a title like "Hebcal 2020 Israel" or "Hebcal May 1993 Providence" | ||
@@ -411,3 +441,2 @@ * @param {Event[]} events | ||
const date = options.euro ? `"${mday}/${mon}/${year}"` : `"${mon}/${mday}/${year}"`; | ||
let subj = e.render(); | ||
let startTime = ''; | ||
@@ -418,3 +447,3 @@ let endTime = ''; | ||
const timed = Boolean(e.eventTime); | ||
const desc = e.getDesc(); | ||
let subj = timed ? renderTitleWithoutTime(e) : e.render(); | ||
@@ -426,11 +455,2 @@ if (e.eventTime) { | ||
allDay = '"false"'; | ||
if (desc === 'Havdalah' || desc === 'Candle lighting') { | ||
// replace "Candle lighting: 15:34" with shorter title | ||
const colon = subj.indexOf(': '); | ||
if (colon != -1) { | ||
subj = subj.substring(0, colon); | ||
} | ||
} | ||
} | ||
@@ -534,3 +554,3 @@ | ||
const categories = getEventCategories(ev); | ||
let title = ev.render(); | ||
let title = timed ? renderTitleWithoutTime(ev) : ev.render(); | ||
const desc = ev.getDesc(); | ||
@@ -540,8 +560,4 @@ const candles = desc === 'Havdalah' || desc === 'Candle lighting'; | ||
if (candles) { | ||
const colon = title.indexOf(': '); | ||
if (colon != -1) { | ||
const time = core__default['default'].HebrewCalendar.reformatTimeStr(ev.eventTimeStr, 'pm', options); | ||
title = title.substring(0, colon) + ': ' + time; | ||
} | ||
const time = core__default['default'].HebrewCalendar.reformatTimeStr(ev.eventTimeStr, 'pm', options); | ||
title += ': ' + time; | ||
} | ||
@@ -900,2 +916,3 @@ | ||
exports.pad4 = pad4; | ||
exports.renderTitleWithoutTime = renderTitleWithoutTime; | ||
exports.timeZoneOffsetStr = timeZoneOffsetStr; | ||
@@ -906,3 +923,3 @@ exports.toISOString = toISOString; | ||
var version="2.7.0"; | ||
var version="2.8.0"; | ||
@@ -994,7 +1011,7 @@ /* eslint-disable max-len */ | ||
const dtstamp = options.dtstamp || makeDtstamp(new Date()); | ||
let subj = e.render(); | ||
const timed = Boolean(e.eventTime); | ||
let subj = timed ? dist.renderTitleWithoutTime(e) : e.render(); | ||
const desc = e.getDesc(); // original untranslated | ||
const mask = e.getFlags(); | ||
const timed = Boolean(e.eventTime); | ||
const candles = desc === 'Havdalah' || desc === 'Candle lighting'; | ||
@@ -1035,11 +1052,3 @@ let location; | ||
endDate = startDate; | ||
dtargs = `;TZID=${options.location.tzid}`; // replace "Candle lighting: 15:34" with shorter title | ||
if (candles) { | ||
const colon = subj.indexOf(': '); | ||
if (colon != -1) { | ||
subj = subj.substring(0, colon); | ||
} | ||
} | ||
dtargs = `;TZID=${options.location.tzid}`; | ||
} else { | ||
@@ -1046,0 +1055,0 @@ endDate = formatYYYYMMDD(e.getDate().next().greg()); // for all-day untimed, use DTEND;VALUE=DATE intsead of DURATION:P1D. |
{ | ||
"name": "@hebcal/icalendar", | ||
"version": "2.7.0", | ||
"version": "2.8.0", | ||
"author": "Michael J. Radwin (https://github.com/mjradwin)", | ||
@@ -26,4 +26,4 @@ "keywords": [ | ||
"dependencies": { | ||
"@hebcal/core": "^2.6.1", | ||
"@hebcal/rest-api": "^2.7.2", | ||
"@hebcal/core": "^2.7.0", | ||
"@hebcal/rest-api": "^2.8.0", | ||
"md5": "^2.3.0" | ||
@@ -59,17 +59,17 @@ }, | ||
"@ava/babel": "^1.0.1", | ||
"@babel/core": "^7.12.3", | ||
"@babel/core": "^7.12.8", | ||
"@babel/polyfill": "^7.12.1", | ||
"@babel/preset-env": "^7.12.1", | ||
"@babel/preset-env": "^7.12.7", | ||
"@babel/register": "^7.12.1", | ||
"@rollup/plugin-babel": "^5.2.1", | ||
"@rollup/plugin-commonjs": "^15.1.0", | ||
"@rollup/plugin-commonjs": "^16.0.0", | ||
"@rollup/plugin-json": "^4.1.0", | ||
"@rollup/plugin-node-resolve": "^9.0.0", | ||
"@rollup/plugin-node-resolve": "^10.0.0", | ||
"ava": "^3.13.0", | ||
"eslint": "^7.12.0", | ||
"eslint": "^7.14.0", | ||
"eslint-config-google": "^0.14.0", | ||
"jsdoc": "^3.6.6", | ||
"jsdoc-to-markdown": "^6.0.1", | ||
"rollup": "^2.32.1" | ||
"rollup": "^2.33.3" | ||
} | ||
} |
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
53624
1091
Updated@hebcal/core@^2.7.0
Updated@hebcal/rest-api@^2.8.0