diff --git a/server/src/events/announce.js b/server/src/events/announce.js index e8d0f76..db52ade 100644 --- a/server/src/events/announce.js +++ b/server/src/events/announce.js @@ -67,7 +67,18 @@ function startsAtLabel(at, zone) { // Explicit rather than left to the locale, because `en-GB` would otherwise // render midnight as "00:00" while the schedule editor beside it writes // "12:00 AM" — one event, two spellings of the same instant. - hour12: true, + // + // `hourCycle: 'h12'` and NOT `hour12: true`, which is not the same request + // and does not survive a Node upgrade. For a locale whose default cycle is + // h23 — `en-GB` is one — Node 20 resolves `hour12: true` to **h11**, whose + // hours run 0–11, so midnight comes out "0:00 am"; Node 22 and later + // resolve it to h12 and it comes out "12:00 am". Same ICU on both, so this + // is V8's ECMA-402 behaviour and not locale data, and the image ships + // node:20-alpine while a dev machine is newer — which is how this rendered + // correctly in front of everyone who wrote it and wrongly for every real + // recipient. `recurrence.js` states the mirror-image rule for `h23`; there + // is no `hour12` left in this repo and it should stay that way. + hourCycle: 'h12', }).format(when) return `${text} (${zone || 'UTC'})` } catch { diff --git a/server/test/eventAnnounce.test.js b/server/test/eventAnnounce.test.js index bb72fc3..4d09e4c 100644 --- a/server/test/eventAnnounce.test.js +++ b/server/test/eventAnnounce.test.js @@ -260,9 +260,15 @@ test('the start time is written out in the SHARD\'s zone, not the server\'s', () }) test('midnight reads as 12:00 am and never as 00:00', () => { - // `hour12` is set explicitly. Left to the en-GB locale this would render + // The hour cycle is set explicitly. Left to the en-GB locale this would render // "00:00" while the schedule editor beside it writes "12:00 AM" — one event, // two spellings of the same instant. + // + // This assertion only has teeth on the Node the image ships (20), where + // `hour12: true` resolves to h11 and midnight reads "0:00 am". On Node 22+ it + // passes either way — so a green run on a dev machine is not evidence, and CI + // is what actually holds this line. See the note beside `hourCycle` in + // events/announce.js. assert.match(announce.startsAtLabel(new Date('2026-09-13T04:00:00Z'), 'America/New_York'), /12:00 am/) })