Skip to content

Commit

Permalink
Add Sefirat HaOmer to omer event memo
Browse files Browse the repository at this point in the history
  • Loading branch information
mjradwin committed Jul 4, 2021
1 parent b323c90 commit 6a5bf0a
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 15 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hebcal/icalendar",
"version": "4.9.3",
"version": "4.10.0",
"author": "Michael J. Radwin (https://github.com/mjradwin)",
"keywords": [
"ical",
Expand All @@ -24,7 +24,7 @@
"url": "https://github.com/hebcal/hebcal-icalendar/issues"
},
"dependencies": {
"@hebcal/core": "^3.20.3",
"@hebcal/core": "^3.21.0",
"@hebcal/rest-api": "^3.7.0"
},
"scripts": {
Expand Down Expand Up @@ -64,11 +64,11 @@
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.0.0",
"ava": "^3.15.0",
"eslint": "^7.29.0",
"eslint": "^7.30.0",
"eslint-config-google": "^0.14.0",
"jsdoc": "^3.6.7",
"jsdoc-to-markdown": "^6.0.1",
"murmurhash-js": "^1.0.0",
"rollup": "^2.52.3"
"rollup": "^2.52.7"
}
}
6 changes: 5 additions & 1 deletion src/icalendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,13 @@ function createMemo(e, il) {
if (candles) {
return e.memo || '';
}
const mask = e.getFlags();
if (mask & flags.OMER_COUNT) {
return e.getTodayIs('en') + '\\n\\n' + e.memo;
}
const url = appendTrackingToUrl(e.url(), il);
const torahMemo = makeTorahMemoText(e, il).replace(/\n/g, '\\n');
if (e.getFlags() & flags.PARSHA_HASHAVUA) {
if (mask & flags.PARSHA_HASHAVUA) {
return torahMemo + '\\n\\n' + url;
} else {
let memo = e.memo || getHolidayDescription(e);
Expand Down
33 changes: 23 additions & 10 deletions src/icalendar.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,15 +215,6 @@ test('ical-dafyomi', (t) => {
t.deepEqual(lines, expected);
});

test('ical-omer', (t) => {
const options = {year: 1993, noHolidays: true, omer: true, emoji: true};
const ev = HebrewCalendar.calendar(options)[0];
const ical = new IcalEvent(ev, options);
const lines = ical.toString().split('\r\n');
t.is(lines.length, 16);
t.is(findLine(lines, 'SUMMARY'), '0️⃣1️⃣ 1st day of the Omer');
});

test('eventsToIcalendar', async (t) => {
const options = {
year: 2020,
Expand Down Expand Up @@ -482,5 +473,27 @@ test('OmerEvent', (t) => {
const ev = new OmerEvent(new HDate(22, 'Iyyar', 5781), 37);
const icalEvent = new IcalEvent(ev, {emoji: true});
const lines = icalEvent.toString().split('\r\n');
t.is(findLine(lines, 'SUMMARY'), '3️⃣7️⃣ 37th day of the Omer');
lines[1] = 'DTSTAMP:X';
lines[6] = 'UID:X';
const expected = [
'BEGIN:VEVENT',
'DTSTAMP:X',
'SUMMARY:3️⃣7️⃣ 37th day of the Omer',
'DTSTART;VALUE=DATE:20210504',
'DTEND;VALUE=DATE:20210505',
'UID:hebcal-20210504-45f4acad',
'UID:X',
'X-MICROSOFT-CDO-BUSYSTATUS:FREE',
'X-MICROSOFT-CDO-ALLDAYEVENT:TRUE',
'CLASS:PUBLIC',
'DESCRIPTION:Today is 37 days\\, which is 5 weeks and 2 days of the Omer\\n\\n',
' Might that is in Foundation / גְבוּרָה שֶׁבַּיְּסוֹד',
'BEGIN:VALARM',
'ACTION:DISPLAY',
'DESCRIPTION:This is an event reminder',
'TRIGGER:-P0DT3H30M0S',
'END:VALARM',
'END:VEVENT',
];
t.deepEqual(lines, expected);
});

0 comments on commit 6a5bf0a

Please sign in to comment.