From b7de64249d2a5aae1859e6627296aa2fd2f116c2 Mon Sep 17 00:00:00 2001 From: "Michael J. Radwin" Date: Tue, 1 Oct 2024 07:17:37 -0700 Subject: [PATCH] On parsha index page, more strictly display date of next read for doubled parshiyot --- src/sedrot.js | 13 ++++++++++++- views/parsha-detail.ejs | 4 +++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/sedrot.js b/src/sedrot.js index 6fb83bd..124ccc3 100644 --- a/src/sedrot.js +++ b/src/sedrot.js @@ -187,6 +187,17 @@ export async function parshaDetail(ctx) { const [p1] = parsha.name.split('-'); Object.assign(commentary, drash[p1]); } + let nextRead; + if (!date) { + const today = dayjs(); + for (const item of items) { + if (item.d.isAfter(today)) { + break; + } else { + nextRead = item; + } + } + } // doubled parsha overwrites first half Object.assign(commentary, drash[parsha.name]); await ctx.render('parsha-detail', { @@ -194,7 +205,7 @@ export async function parshaDetail(ctx) { parsha, parshaName: parsha.name.replace(/'/g, '’'), parshaAnchor, - parshaDateAnchor: getParshaDateAnchor(parshaEv).anchor, + nextRead, reading, il, iSuffix, diff --git a/views/parsha-detail.ejs b/views/parsha-detail.ejs index d1f9fa8..8a8842a 100644 --- a/views/parsha-detail.ejs +++ b/views/parsha-detail.ejs @@ -27,7 +27,9 @@ ol.list-unstyled li {margin-bottom: 0.33em} <% } -%>

Parashat <%=parshaName%> is the <%=parsha.ordinal%> weekly Torah portion in the annual Jewish cycle of Torah reading. <% if (!date) { -%> -Next read <% if (israelDiasporaDiffer) { %>in <%=locationName%><% } %> on / <%= hd.toString().replace(/'/g, '’') %>. +Next read <% if (israelDiasporaDiffer) { %>in <%=locationName%><% } %> on + + / <%= nextRead.event.getDate().toString().replace(/'/g, '’') %>. <% } -%>

<% if (israelDiasporaDiffer) { -%>