From 4a0f9521f09f8a087ef014bcf62e56c05383a578 Mon Sep 17 00:00:00 2001 From: "Michael J. Radwin" Date: Wed, 21 Sep 2022 10:05:25 -0700 Subject: [PATCH] Include Mincha reading in CSV for Tish'a B'Av (observed) --- package-lock.json | 21 ++++++++++++--------- package.json | 4 ++-- src/csv.js | 27 +++------------------------ 3 files changed, 17 insertions(+), 35 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5108a3b..7414c54 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,16 +1,19 @@ { "name": "@hebcal/triennial", - "version": "1.0.1", + "version": "1.0.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@hebcal/triennial", - "version": "1.0.1", + "version": "1.0.2", "license": "BSD-2-Clause", "dependencies": { "@hebcal/core": "^3.44.2", - "@hebcal/leyning": "^6.0.4" + "@hebcal/leyning": "^6.1.0" + }, + "bin": { + "triennial-csv": "bin/triennial-csv" }, "devDependencies": { "@babel/core": "^7.19.1", @@ -1707,9 +1710,9 @@ } }, "node_modules/@hebcal/leyning": { - "version": "6.0.4", - "resolved": "https://registry.npmjs.org/@hebcal/leyning/-/leyning-6.0.4.tgz", - "integrity": "sha512-UrRE9c27EuiDn7/Hq6O0lXBswul71oB4qVGzcQ5gR2yI4Vkc2V/nP65oeYqbRjDVI/d0ThsZnlRw8oAWYaqB0w==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@hebcal/leyning/-/leyning-6.1.0.tgz", + "integrity": "sha512-sscbh5+pW6kXB+QUHtIp9bZeGDe/RZ5V2aAolRkbNNLtYPp+RCBHd5RX6rsQyWPmGoIwT0O/K2mSgrajmAjNBQ==", "dependencies": { "@hebcal/core": "^3.44.2" }, @@ -7746,9 +7749,9 @@ "integrity": "sha512-JhEVpU2g+efL7l+tKaUTO19JKYRZUfuTiHO71zGftGo5PPjzA3NJB/x/0VmMiGqQ3hcLbp8G/75cTloJBNK+/A==" }, "@hebcal/leyning": { - "version": "6.0.4", - "resolved": "https://registry.npmjs.org/@hebcal/leyning/-/leyning-6.0.4.tgz", - "integrity": "sha512-UrRE9c27EuiDn7/Hq6O0lXBswul71oB4qVGzcQ5gR2yI4Vkc2V/nP65oeYqbRjDVI/d0ThsZnlRw8oAWYaqB0w==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@hebcal/leyning/-/leyning-6.1.0.tgz", + "integrity": "sha512-sscbh5+pW6kXB+QUHtIp9bZeGDe/RZ5V2aAolRkbNNLtYPp+RCBHd5RX6rsQyWPmGoIwT0O/K2mSgrajmAjNBQ==", "requires": { "@hebcal/core": "^3.44.2" } diff --git a/package.json b/package.json index 1435e50..5428916 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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": [ diff --git a/src/csv.js b/src/csv.js index 28b7d6f..53b598a 100644 --- a/src/csv.js +++ b/src/csv.js @@ -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} - */ -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 @@ -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); } }