Server: one summary builder for both Wikipedia APIs, one reset-time conversion

summary() and summaryFromAction() assembled the same record field by field; the subscription
code converted reset times the way usage.ts's epochIso already does; attribution() spelled out
restTitle(). The "|0" cache-key comment says why it stays rather than how it came about.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014yB6q4BHMwptTX3YFtkRab
This commit is contained in:
thalladaandClaude Opus 5.5 committed 2026-11-17 16:07:12 -05:00
1 parent 63593fdb22
commit 7f6b9d8e77
3 files changed
+14 -26

No files matched your search

+2 -2
View File
@@ -100,8 +100,8 @@ const LABELS: Record<string, string> = {
};
const labelOf = (id: string) => LABELS[id] ?? (id.startsWith("model:") ? `weekly ${id.slice(6)}` : id.replaceAll("_", " "));
/** SDK reset times are unix seconds (the subscription code accepts milliseconds too, defensively). */
const epochIso = (t: number | undefined | null) => (typeof t === "number" && Number.isFinite(t) ? new Date(t < 1e12 ? t * 1000 : t).toISOString() : null);
/** SDK reset times are unix seconds (milliseconds accepted). */
export const epochIso = (t: number | undefined | null) => (typeof t === "number" && Number.isFinite(t) ? new Date(t < 1e12 ? t * 1000 : t).toISOString() : null);
const isoOrNull = (s: string | null | undefined) => (s && !Number.isNaN(Date.parse(s)) ? new Date(s).toISOString() : null);
const finite = (n: unknown): n is number => typeof n === "number" && Number.isFinite(n);
/** A fraction as a percentage, without float noise (0.96 → 96, not 96.00000000000001). */