From afc05561dbb9e8db9d7c0867931fb08cccba8de4 Mon Sep 17 00:00:00 2001 From: zumbrunn Date: Wed, 2 Sep 2026 22:25:36 +0200 Subject: [PATCH] fix(admin): submissions list reads receivedAt, not missing createdAt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The per-form submissions list at /admin/submissions/{form} rendered the timestamp from `s.createdAt`, a field that does not exist on the `Submission` interface (the timestamp is `receivedAt`, Unix ms). Every row showed "Invalid Date". Confirmed live: a real submission with `"receivedAt": 1788249949694` rendered "Invalid Date" in the list (the detail route was unaffected — it already uses `receivedAt`). The overall list route (submissions/index.tsx) has no date column, and no other `.createdAt` references exist under routes/submissions/. Adds a regression test rendering the route with a set `receivedAt` and asserting the output contains a valid formatted date, not "Invalid Date". Co-Authored-By: Claude Sonnet 5 --- src/admin/routes/submissions/[form]/index.tsx | 4 +-- tests/admin/submissions_list_test.tsx | 27 +++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 tests/admin/submissions_list_test.tsx diff --git a/src/admin/routes/submissions/[form]/index.tsx b/src/admin/routes/submissions/[form]/index.tsx index c442791..b04aef6 100644 --- a/src/admin/routes/submissions/[form]/index.tsx +++ b/src/admin/routes/submissions/[form]/index.tsx @@ -31,10 +31,10 @@ export default function SubmissionsFormRoute( - {(data.items as Array<{ id: string; createdAt: number; status: string }>).map((s) => ( + {(data.items as Array<{ id: string; receivedAt: number; status: string }>).map((s) => ( - + diff --git a/tests/admin/submissions_list_test.tsx b/tests/admin/submissions_list_test.tsx new file mode 100644 index 0000000..743bdae --- /dev/null +++ b/tests/admin/submissions_list_test.tsx @@ -0,0 +1,27 @@ +/** @jsxImportSource preact */ +/** + * Regression test: the per-form submissions list must render the submission + * timestamp from `receivedAt` (Unix ms, the field on the Submission + * interface). It previously read `s.createdAt`, which does not exist, so + * every row showed "Invalid Date". + */ + +import { assertEquals, assertStringIncludes } from "https://deno.land/std@0.224.0/assert/mod.ts"; +import { render } from "preact-render-to-string"; +import SubmissionsFormRoute from "../../src/admin/routes/submissions/[form]/index.tsx"; + +Deno.test("submissions list: renders a valid date from receivedAt (not 'Invalid Date')", () => { + const receivedAt = 1788249949694; + const html = render( + , + ); + + assertEquals(html.includes("Invalid Date"), false); + assertStringIncludes(html, new Date(receivedAt).toLocaleString()); +});
IDSubmittedStatus
{s.id}{new Date(s.createdAt).toLocaleString()}{new Date(s.receivedAt).toLocaleString()} {s.status} View