fix(web): diagnose personal-report schema failures and ISO list timestamps
Keep report_schema_invalid for the user, but record the inner check, retry plan bind once, and format self-hosted timestamptz so the report list no longer shows 时间未知. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
|
||||
import { queryValue } from "../src/lib/db/local-postgres-client-core.ts";
|
||||
|
||||
test("queryValue keeps calendar dates in local civil form", () => {
|
||||
assert.equal(queryValue("date", new Date(2026, 7, 22)), "2026-08-22");
|
||||
});
|
||||
|
||||
test("queryValue projects timestamptz and timestamp Date values as ISO strings", () => {
|
||||
const instant = new Date("2026-08-22T12:34:56.000Z");
|
||||
assert.equal(queryValue("timestamptz", instant), "2026-08-22T12:34:56.000Z");
|
||||
assert.equal(queryValue("timestamp", instant), "2026-08-22T12:34:56.000Z");
|
||||
assert.equal(queryValue("timestamp with time zone", instant), "2026-08-22T12:34:56.000Z");
|
||||
assert.equal(queryValue("timestamp without time zone", instant), "2026-08-22T12:34:56.000Z");
|
||||
});
|
||||
|
||||
test("queryValue leaves non-date values unchanged", () => {
|
||||
assert.equal(queryValue("timestamptz", "2026-08-22T12:34:56.000Z"), "2026-08-22T12:34:56.000Z");
|
||||
assert.equal(queryValue("text", "hello"), "hello");
|
||||
const leftover = new Date("2026-08-22T12:34:56.000Z");
|
||||
assert.equal(queryValue("unknown", leftover), leftover);
|
||||
});
|
||||
Reference in New Issue
Block a user