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:
Jesse_Chen
2026-08-22 20:46:30 +08:00
co-authored by Cursor
parent 4b3d82d987
commit 9762063453
13 changed files with 341 additions and 72 deletions
@@ -136,14 +136,25 @@ function databaseValue(type: string | undefined, value: unknown): unknown {
return value;
}
function queryValue(type: string | undefined, value: unknown): unknown {
if (type !== "date" || !(value instanceof Date)) return value;
// pg parses DATE at local midnight; UTC formatting can shift the calendar day.
return [
String(value.getFullYear()).padStart(4, "0"),
String(value.getMonth() + 1).padStart(2, "0"),
String(value.getDate()).padStart(2, "0"),
].join("-");
export function queryValue(type: string | undefined, value: unknown): unknown {
if (!(value instanceof Date) || !Number.isFinite(value.getTime())) return value;
if (type === "date") {
// pg parses DATE at local midnight; UTC formatting can shift the calendar day.
return [
String(value.getFullYear()).padStart(4, "0"),
String(value.getMonth() + 1).padStart(2, "0"),
String(value.getDate()).padStart(2, "0"),
].join("-");
}
if (
type === "timestamptz"
|| type === "timestamp"
|| type === "timestamp with time zone"
|| type === "timestamp without time zone"
) {
return value.toISOString();
}
return value;
}
class LocalPostgresQueryBuilder implements PromiseLike<QueryResult> {