From 71dceba7ad499c9d8dcf48f61acf05762f33b982 Mon Sep 17 00:00:00 2001
From: "Michael J. Radwin" If a special Haftarah applies, the result will have a Looks up leyning for a given holiday key. Key should be an
(untranslated) string used in holiday-readings.json. Returns some
of full kriyah aliyot, special Maftir, special Haftarahaliyot['M']
replaced and sets reason.M
haft
property
pointing to Haftarah object and sets reason.haftara
.Leyning
Leyning
Looks up leyning for a regular Shabbat parsha, including any special maftir or Haftara.
ParshaMeta
Returns the parsha metadata
+Leyning
| Array.<Leyning>
Looks up leyning for a regular Shabbat, Monday/Thursday weekday or holiday.
If hdate
coincides with a holiday that has Torah reading, returns the
@@ -127,9 +130,6 @@ reading for that day (see getLeyningForHoliday
Parashat haShavua, containing only the weekday
aliyot (no fullkriyah
).
Otherwise, returns undefined
.
ParshaMeta
Returns the parsha metadata
-Formats reading for CSV
Leyning
](#Leyning)
+## getLeyningForHolidayKey(key, [cholHaMoedDay], [il]) ⇒ [Leyning
](#Leyning)
Looks up leyning for a given holiday key. Key should be an
(untranslated) string used in holiday-readings.json. Returns some
of full kriyah aliyot, special Maftir, special Haftarah
@@ -341,6 +341,7 @@ of full kriyah aliyot, special Maftir, special Haftarah
| --- | --- | --- |
| key | string
| name from `holiday-readings.json` to find |
| [cholHaMoedDay] | number
| |
+| [il] | boolean
| |
@@ -394,6 +395,17 @@ maftir or Haftara.
| ev | Event
| | the Hebcal event associated with this leyning |
| [il] | boolean
| false
| in Israel |
+
+
+## lookupParsha(parsha) ⇒ [ParshaMeta
](#ParshaMeta)
+Returns the parsha metadata
+
+**Kind**: global function
+
+| Param | Type | Description |
+| --- | --- | --- |
+| parsha | string
\| Array.<string>
| untranslated name like 'Pinchas' or ['Pinchas'] or ['Matot','Masei'] |
+
## getLeyningOnDate(hdate, il, [wantarray]) ⇒ [Leyning
](#Leyning) \| [Array.<Leyning>
](#Leyning)
@@ -418,17 +430,6 @@ Otherwise, returns `undefined`.
| il | boolean
| | in Israel |
| [wantarray] | boolean
| false
| to return an array of 0 or more readings |
-
-
-## lookupParsha(parsha) ⇒ [ParshaMeta
](#ParshaMeta)
-Returns the parsha metadata
-
-**Kind**: global function
-
-| Param | Type | Description |
-| --- | --- | --- |
-| parsha | string
\| Array.<string>
| untranslated name like 'Pinchas' or ['Pinchas'] or ['Matot','Masei'] |
-
## writeCsvLines(stream, ev, reading, il, isParsha)
diff --git a/leyning.d.ts b/leyning.d.ts
index 2f210bc..35e9059 100644
--- a/leyning.d.ts
+++ b/leyning.d.ts
@@ -162,9 +162,11 @@ declare module '@hebcal/leyning' {
* (untranslated) string used in holiday-readings.json. Returns some
* of full kriyah aliyot, special Maftir, special Haftarah
* @param key - name from `holiday-readings.json` to find
+ * @param [cholHaMoedDay] - `ev.cholHaMoedDay` or `undefined`
+ * @param [il] - true if Israel holiday scheme
* @returns map of aliyot
*/
- export function getLeyningForHolidayKey(key: string): Leyning;
+ export function getLeyningForHolidayKey(key: string, cholHaMoedDay?: number, il?: boolean): Leyning;
/**
* Looks up leyning for a regular Shabbat parsha, including any special
diff --git a/package-lock.json b/package-lock.json
index 85a26cb..df3c402 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@hebcal/leyning",
- "version": "7.3.2",
+ "version": "7.4.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@hebcal/leyning",
- "version": "7.3.2",
+ "version": "7.4.0",
"license": "BSD-2-Clause",
"dependencies": {
"@hebcal/core": "^4.0.3"
@@ -2469,9 +2469,9 @@
}
},
"node_modules/caniuse-lite": {
- "version": "1.0.30001487",
- "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001487.tgz",
- "integrity": "sha512-83564Z3yWGqXsh2vaH/mhXfEM0wX+NlBCm1jYHOb97TrTWJEmPTccZgeLTPBUUb0PNVo+oomb7wkimZBIERClA==",
+ "version": "1.0.30001488",
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001488.tgz",
+ "integrity": "sha512-NORIQuuL4xGpIy6iCCQGN4iFjlBXtfKWIenlUuyZJumLRIindLb7wXM+GO8erEhb7vXfcnf4BAg2PrSDN5TNLQ==",
"dev": true,
"funding": [
{
diff --git a/package.json b/package.json
index 928d18a..f6d2e8f 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@hebcal/leyning",
- "version": "7.3.3",
+ "version": "7.4.0",
"author": "Michael J. Radwin (https://github.com/mjradwin)",
"keywords": [
"hebcal",
diff --git a/src/csv.js b/src/csv.js
index 25c51d4..c609190 100644
--- a/src/csv.js
+++ b/src/csv.js
@@ -101,9 +101,9 @@ export function writeFullKriyahEvent(stream, ev, il) {
export function writeHolidayMincha(stream, ev, il) {
const desc = ev.getDesc();
const minchaDesc1 = desc + ' (Mincha)';
- const readingMincha1 = getLeyningForHolidayKey(minchaDesc1);
+ const readingMincha1 = getLeyningForHolidayKey(minchaDesc1, ev.cholHaMoedDay, il);
const readingMincha = readingMincha1 ||
- getLeyningForHolidayKey(getLeyningKeyForEvent(ev, il) + ' (Mincha)');
+ getLeyningForHolidayKey(getLeyningKeyForEvent(ev, il) + ' (Mincha)', ev.cholHaMoedDay, il);
if (readingMincha) {
const minchaEv = new Event(ev.getDate(), minchaDesc1, flags.USER_EVENT);
writeCsvLines(stream, minchaEv, readingMincha, il, false);
diff --git a/src/getLeyningForHoliday.js b/src/getLeyningForHoliday.js
index b3a94e0..4c5d11a 100644
--- a/src/getLeyningForHoliday.js
+++ b/src/getLeyningForHoliday.js
@@ -12,9 +12,10 @@ import numverses from './numverses.json';
* of full kriyah aliyot, special Maftir, special Haftarah
* @param {string} key name from `holiday-readings.json` to find
* @param {number} [cholHaMoedDay]
+ * @param {boolean} [il]
* @return {Leyning} map of aliyot
*/
-export function getLeyningForHolidayKey(key, cholHaMoedDay) {
+export function getLeyningForHolidayKey(key, cholHaMoedDay, il) {
if (typeof key !== 'string') {
return undefined;
}
@@ -22,6 +23,9 @@ export function getLeyningForHolidayKey(key, cholHaMoedDay) {
if (typeof src === 'undefined') {
return undefined;
}
+ if (typeof src.il === 'boolean' && typeof il === 'boolean' && il !== src.il) {
+ return undefined;
+ }
const leyning = {
name: {
en: key,
@@ -86,6 +90,6 @@ export function getLeyningForHoliday(ev, il = false) {
return undefined;
}
const key = getLeyningKeyForEvent(ev, il);
- const leyning = getLeyningForHolidayKey(key, ev.cholHaMoedDay);
+ const leyning = getLeyningForHolidayKey(key, ev.cholHaMoedDay, il);
return leyning;
}
diff --git a/src/getLeyningOnDate.js b/src/getLeyningOnDate.js
index 58e1c4f..5de1a33 100644
--- a/src/getLeyningOnDate.js
+++ b/src/getLeyningOnDate.js
@@ -104,13 +104,13 @@ const minchaSuffix = ' (Mincha)';
*/
function getMincha(ev, il) {
const desc = ev.getDesc() + minchaSuffix;
- const reading1 = getLeyningForHolidayKey(desc);
+ const reading1 = getLeyningForHolidayKey(desc, ev.cholHaMoedDay, il);
if (reading1) {
return reading1;
}
const desc2 = getLeyningKeyForEvent(ev, il);
if (desc2) {
- const reading2 = getLeyningForHolidayKey(desc2 + minchaSuffix);
+ const reading2 = getLeyningForHolidayKey(desc2 + minchaSuffix, ev.cholHaMoedDay, il);
if (reading2) {
return reading2;
}
diff --git a/src/holiday-readings.json b/src/holiday-readings.json
index 93fc096..0436ec3 100644
--- a/src/holiday-readings.json
+++ b/src/holiday-readings.json
@@ -30,6 +30,7 @@
"M":{"p":41,"k":4,"b":"28:16","e":"28:25"}}},
"Pesach II (CH''M)":{
"note":"Israel only - according to Vaani T'fillati Siddur Yisraeli",
+ "il":true,
"fullkriyah":
{"1":{"p":31,"k":3,"b":"22:26","e":"23:8"},
"2":{"p":31,"k":3,"b":"23:9","e":"23:14"},
@@ -119,6 +120,7 @@
"Pesach Chol ha-Moed Day 3 on Monday":{"alias":true,"il":false,"key":"Pesach Chol ha-Moed Day 2"},
"Shavuot":{
"note":"Israel only",
+ "il":true,
"megillah":"Ruth",
"haft":[{"k":"Ezekiel","b":"1:1","e":"1:28"},
{"k":"Ezekiel","b":"3:12","e":"3:12"}],
@@ -472,12 +474,14 @@
"3":{"p":16,"k":2,"b":"17:14","e":"17:16"}}},
"Shushan Purim":{
"note":"Jerusalem & walled cities only",
+ "il":true,
"megillah":"Esther",
"fullkriyah":
{"1":{"p":16,"k":2,"b":"17:8","e":"17:10"},
"2":{"p":16,"k":2,"b":"17:11","e":"17:13"},
"3":{"p":16,"k":2,"b":"17:14","e":"17:16"}}},
"Shushan Purim (on Shabbat)":{
+ "il":true,
"note":"Jerusalem & walled cities only: special maftir Exodus 17:8-16, same Haftara as Shabbat Zachor"},
"Shabbat HaChodesh":{
"haft":{"k":"Ezekiel","b":"45:16","e":"46:18"},
diff --git a/src/holiday.spec.js b/src/holiday.spec.js
index 8131981..0044b55 100644
--- a/src/holiday.spec.js
+++ b/src/holiday.spec.js
@@ -101,7 +101,7 @@ function formatAliyah(aliyot, num) {
return formatAliyahWithBook(aliyot.fullkriyah[num]);
}
-test('getLeyningForHoliday', (t) => {
+test('getLeyningForHoliday-il', (t) => {
const options = {year: 5757, isHebrewYear: true, il: true};
const events = HebrewCalendar.calendar(options);
@@ -110,19 +110,41 @@ test('getLeyningForHoliday', (t) => {
t.is(sukkot1a.fullkriyah['7'].p, 31);
t.is(sukkot1a.summary, 'Leviticus 22:26-23:44; Numbers 29:12-16');
const sukkot2 = events.find((e) => e.getDesc() == 'Sukkot II (CH\'\'M)');
- t.is(getLeyningForHoliday(sukkot2).fullkriyah['4'].p, 41);
+ t.is(getLeyningForHoliday(sukkot2, true).fullkriyah['4'].p, 41);
const shminiAtzeret = events.find((e) => e.getDesc() == 'Shmini Atzeret');
- t.is(getLeyningForHoliday(shminiAtzeret).fullkriyah['7'].p, 47);
+ t.is(getLeyningForHoliday(shminiAtzeret, true).fullkriyah['7'].p, 1);
const tevet17 = events.find((e) => e.getDesc() == 'Asara B\'Tevet');
- t.is(getLeyningForHoliday(tevet17).fullkriyah['3'].e, '34:10');
+ t.is(getLeyningForHoliday(tevet17, true).fullkriyah['3'].e, '34:10');
const pesach5 = events.find((e) => e.getDesc() == 'Pesach V (CH\'\'M)');
- t.is(getLeyningForHoliday(pesach5).fullkriyah['4'].p, 21);
+ t.is(getLeyningForHoliday(pesach5, true).fullkriyah['4'].p, 21);
const shavuot = events.find((e) => e.getDesc() == 'Shavuot');
- t.is(getLeyningForHoliday(shavuot).fullkriyah['4'].p, 17);
+ t.is(getLeyningForHoliday(shavuot, true).fullkriyah['4'].p, 17);
const av9 = events.find((e) => e.getDesc() == 'Tish\'a B\'Av');
- t.is(getLeyningForHoliday(av9).haftara, 'Jeremiah 8:13-9:23');
+ t.is(getLeyningForHoliday(av9, true).haftara, 'Jeremiah 8:13-9:23');
});
+test('getLeyningForHoliday-diaspora', (t) => {
+ const events = HebrewCalendar.calendar({year: 5757, isHebrewYear: true, il: false});
+
+ const sukkot1 = events.find((e) => e.getDesc() == 'Sukkot I');
+ const sukkot1a = getLeyningForHoliday(sukkot1);
+ t.is(sukkot1a.fullkriyah['7'].p, 31);
+ t.is(sukkot1a.summary, 'Leviticus 22:26-23:44; Numbers 29:12-16');
+ const sukkot3 = events.find((e) => e.getDesc() == 'Sukkot III (CH\'\'M)');
+ t.is(getLeyningForHoliday(sukkot3, false).fullkriyah['4'].p, 41);
+ const shminiAtzeret = events.find((e) => e.getDesc() == 'Shmini Atzeret');
+ t.is(getLeyningForHoliday(shminiAtzeret, false).fullkriyah['7'].p, 47);
+ const tevet17 = events.find((e) => e.getDesc() == 'Asara B\'Tevet');
+ t.is(getLeyningForHoliday(tevet17, false).fullkriyah['3'].e, '34:10');
+ const pesach5 = events.find((e) => e.getDesc() == 'Pesach V (CH\'\'M)');
+ t.is(getLeyningForHoliday(pesach5, false).fullkriyah['4'].p, 21);
+ const shavuot = events.find((e) => e.getDesc() == 'Shavuot I');
+ t.is(getLeyningForHoliday(shavuot, false).fullkriyah['4'].p, 17);
+ const av9 = events.find((e) => e.getDesc() == 'Tish\'a B\'Av');
+ t.is(getLeyningForHoliday(av9, false).haftara, 'Jeremiah 8:13-9:23');
+});
+
+
test('getLeyningForHoliday-Chanukah', (t) => {
const options = {year: 5757, isHebrewYear: true, il: true};
const events = HebrewCalendar.calendar(options);
@@ -555,7 +577,7 @@ test('pesach-diaspora-chm-day2-sunday', (t) => {
test('Shavuot Israel', (t) => {
const events0 = HebrewCalendar.calendar({year: 5783, isHebrewYear: true, il: true});
const events = events0.filter((ev) => ev.getDesc() === 'Shavuot');
- const actual = getLeyningForHoliday(events[0]);
+ const actual = getLeyningForHoliday(events[0], true);
const expected = {
'1': {k: 'Ruth', b: '1:1', e: '1:22', v: 22},
'2': {k: 'Ruth', b: '2:1', e: '2:23', v: 23},
diff --git a/src/specialReadings.js b/src/specialReadings.js
index c0e24b1..2a17bb9 100644
--- a/src/specialReadings.js
+++ b/src/specialReadings.js
@@ -80,6 +80,9 @@ export function specialReadings2(parsha, hd, il, aliyot) {
if (!special) {
return;
}
+ if (typeof special.il === 'boolean' && il !== special.il) {
+ return;
+ }
if (special.haft && !specialHaft) {
haft = cloneHaftara(special.haft);
reason.haftara = key;