Skip to content

Commit

Permalink
Include Mincha reading in CSV for Tish'a B'Av (observed)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjradwin committed Sep 21, 2022
1 parent a0f20ab commit 4a0f952
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 35 deletions.
21 changes: 12 additions & 9 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hebcal/triennial",
"version": "1.0.2",
"version": "1.0.3",
"description": "Javascript Triennial Torah Readings",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
Expand All @@ -23,7 +23,7 @@
"homepage": "https://github.com/hebcal/hebcal-triennial#readme",
"dependencies": {
"@hebcal/core": "^3.44.2",
"@hebcal/leyning": "^6.0.4"
"@hebcal/leyning": "^6.1.0"
},
"typings": "types.d.ts",
"files": [
Expand Down
27 changes: 3 additions & 24 deletions src/csv.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,9 @@
import {HebrewCalendar, flags, Event} from '@hebcal/core';
import {HebrewCalendar, flags} from '@hebcal/core';
import {getLeyningForParshaHaShavua, getLeyningForHoliday,
getLeyningForHolidayKey,
getParshaDates, writeHolidayMincha,
getLeyningKeyForEvent, writeCsvLines} from '@hebcal/leyning';
import {getTriennialForParshaHaShavua, getTriennialHaftaraForHoliday, Triennial} from './triennial';

/**
* @private
* @param {Event[]} events
* @return {Object<string,boolean>}
*/
function getParshaDates(events) {
const parshaEvents = events.filter((ev) => ev.getFlags() === flags.PARSHA_HASHAVUA);
const parshaDates = parshaEvents.reduce((set, ev) => {
set[ev.getDate().toString()] = true;
return set;
}, {});
return parshaDates;
}

/**
* @private
* @param {fs.WriteStream} stream
Expand Down Expand Up @@ -75,14 +61,7 @@ function writeTriennialEventHoliday(stream, ev) {
reading.triHaftaraNumV = triHaft.haftaraNumV;
}
writeCsvLines(stream, ev, reading, il, false);
}
if (!(ev.getFlags() & flags.ROSH_CHODESH)) {
const minchaDesc = ev.getDesc() + ' (Mincha)';
const readingMincha = getLeyningForHolidayKey(minchaDesc);
if (readingMincha) {
const minchaEv = new Event(ev.getDate(), minchaDesc, flags.USER_EVENT);
writeCsvLines(stream, minchaEv, readingMincha, il, false);
}
writeHolidayMincha(stream, ev, il);
}
}

Expand Down

0 comments on commit 4a0f952

Please sign in to comment.