From 499731523913efb41b31241adf67c1b603714130 Mon Sep 17 00:00:00 2001 From: Snipzil Date: Sun, 18 Oct 2026 14:13:59 -0400 Subject: [PATCH] fix(stats): draw the graphs of a week and longer the dates under the graphs of 7 days and more were formatted with weekday and dateStyle together, which browsers refuse (a TypeError), so render() stopped after the tiles and none of those graphs was drawn on the admin or the moderator panel; only the last 24 hours were. the date is now spelled out instead ("Sun, Oct 18, 2026"). Co-Authored-By: Claude Opus 5.5 --- public/stats-view.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/public/stats-view.html b/public/stats-view.html index 46d3d2d..8711777 100644 --- a/public/stats-view.html +++ b/public/stats-view.html @@ -247,9 +247,12 @@ const date = new Date(at * 1000); return hourly ? date.toLocaleTimeString([], {hour: "numeric"}) : date.toLocaleDateString([], {month: "short", day: "numeric"}); }; + // a day as "Sun, Oct 18, 2026". (weekday cannot go with dateStyle: + // the browser throws, and no graph of a week or more was drawn.) const bucketLong = at => { const date = new Date(at * 1000); - return hourly ? date.toLocaleString([], {weekday: "short", hour: "numeric", minute: "2-digit"}) : date.toLocaleDateString([], {weekday: "short", dateStyle: "medium"}); + return hourly ? date.toLocaleString([], {weekday: "short", hour: "numeric", minute: "2-digit"}) + : date.toLocaleDateString([], {weekday: "short", year: "numeric", month: "short", day: "numeric"}); }; const names = series.map(bucket => bucketName(bucket.at)); byId("stats-online").replaceChildren(lines(