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 <[email protected]>
This commit is contained in:
SnipzilandClaude Opus 5.5 committed 2026-10-18 14:13:59 -04:00
1 parent 1e365b95c5
commit 4997315239
1 file changed
+4 -1
+4 -1
View File
@@ -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(