Skip to content

Commit

Permalink
For empty yahrzeit events, set HTTP Last-Modified to now
Browse files Browse the repository at this point in the history
  • Loading branch information
mjradwin committed Jul 3, 2024
1 parent 92c9679 commit 8a70585
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/yahrzeit.js
Original file line number Diff line number Diff line change
Expand Up @@ -549,15 +549,15 @@ function makeDummyEvent(ctx) {
}

function makeLastModified(details, events) {
let lastModified = details.lastModified;
const now = new Date();
if (events.length === 0) {
return now;
}
let lastModified = details.lastModified;
if (!lastModified) {
// An old /v2/y/ URL won't have a lastModified
lastModified = now;
}
if (events.length === 0) {
return lastModified;
}
const firstEventDt = events[0].getDate().greg();
if (firstEventDt > lastModified && firstEventDt < now) {
lastModified = firstEventDt;
Expand Down

0 comments on commit 8a70585

Please sign in to comment.