From 1d4420ccfcf2526ca011be247156be03803ac2e4 Mon Sep 17 00:00:00 2001 From: "Michael J. Radwin" Date: Mon, 22 Jul 2024 09:17:29 -0700 Subject: [PATCH] Improve caching of shabbat JSON with date-override --- package.json | 2 +- src/shabbat.js | 2 ++ views/holiday-main-index.ejs | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b2d51bf7..d47d3cc1 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "eslint": "^9.7.0", "eslint-plugin-n": "^17.9.0", "globals": "^15.8.0", - "rollup": "^4.18.1" + "rollup": "^4.19.0" }, "dependencies": { "@hebcal/core": "^5.4.11", diff --git a/src/shabbat.js b/src/shabbat.js index cf779f87..ae9e7b81 100644 --- a/src/shabbat.js +++ b/src/shabbat.js @@ -8,6 +8,7 @@ import {makeHebcalOptions, processCookieAndQuery, possiblySetCookie, makeGeoUrlArgs, shortenUrl, queryDefaultCandleMins, + CACHE_CONTROL_7DAYS, localeMap, makeHebrewCalendar} from './common.js'; import {getTodayDate, getDefaultYear, getDefaultHebrewYear, expiresSaturdayNight} from './dateUtil.js'; @@ -46,6 +47,7 @@ export async function shabbatApp(ctx) { } if (dateOverride) { ctx.lastModified = new Date(); + ctx.set('Cache-Control', CACHE_CONTROL_7DAYS); } else { expiresSaturdayNight(ctx, new Date(), options.location.getTzid()); } diff --git a/views/holiday-main-index.ejs b/views/holiday-main-index.ejs index 48ff759a..28d97475 100644 --- a/views/holiday-main-index.ejs +++ b/views/holiday-main-index.ejs @@ -12,7 +12,8 @@

Jewish Holidays <%= yearOverride ? `${hyear - 1}-${hyear + 4}` : '' %>

<% if (hyear <= 5513) { %><%- await include('partials/warning-1752.ejs') %><% } -%> -

Dates of major and minor Jewish holidays as observed in <%= il ? 'Israel' : 'the Diaspora' %>. +

Dates of major and minor Jewish holidays for years <%=hyear-3762%>-<%=hyear-3756%>, + as observed in <%= il ? 'Israel' : 'the Diaspora' %>. Each holiday page includes a brief overview of special observances and customs, and any special Torah readings.