Skip to content

Commit

Permalink
makeTorahMemoText() returns empty string for timed events
Browse files Browse the repository at this point in the history
  • Loading branch information
mjradwin committed Nov 13, 2022
1 parent 112a1e3 commit b953a5b
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 17 deletions.
28 changes: 14 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hebcal/rest-api",
"version": "4.3.5",
"version": "4.3.6",
"author": "Michael J. Radwin (https://github.com/mjradwin)",
"keywords": [
"hebcal"
Expand Down Expand Up @@ -53,11 +53,11 @@
"@rollup/plugin-node-resolve": "^15.0.1",
"@rollup/plugin-terser": "^0.1.0",
"ava": "^5.0.1",
"core-js": "^3.26.0",
"core-js": "^3.26.1",
"eslint": "^8.27.0",
"eslint-config-google": "^0.14.0",
"jsdoc": "^4.0.0",
"jsdoc-to-markdown": "^7.1.1",
"rollup": "^3.2.5"
"rollup": "^3.3.0"
}
}
2 changes: 2 additions & 0 deletions src/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ export function makeTorahMemoText(ev, il) {
const mask = ev.getFlags();
if (mask & HOLIDAY_IGNORE_MASK) {
return '';
} else if (typeof ev.eventTime !== 'undefined') {
return '';
}
const reading = (mask & flags.PARSHA_HASHAVUA) ?
getLeyningForParshaHaShavua(ev, il) :
Expand Down
15 changes: 15 additions & 0 deletions src/common.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,21 @@ test('makeTorahMemoText-userEvent', (t) => {
t.is(makeTorahMemoText(holidayEvent, false), 'Haftarah: Isaiah 66:1-24');
});

test('makeTorahMemoText-untimed', (t) => {
const ev1 = HebrewCalendar.calendar({
start: new Date(2020, 11, 14),
end: new Date(2020, 11, 14),
})[0];
t.is(makeTorahMemoText(ev1, false), 'Torah: Numbers 7:30-41');
const ev2 = HebrewCalendar.calendar({
start: new Date(2020, 11, 14),
end: new Date(2020, 11, 14),
location: Location.lookup('Boston'),
candlelighting: true,
})[0];
t.is(makeTorahMemoText(ev2, false), '');
});

test('getEventCategories', (t) => {
const events = HebrewCalendar.calendar({year: 2022, il: true});
const actual = {};
Expand Down

0 comments on commit b953a5b

Please sign in to comment.