diff --git a/web/src/components/traffic-evidence-viewer.tsx b/web/src/components/traffic-evidence-viewer.tsx index 812c473..05cd577 100644 --- a/web/src/components/traffic-evidence-viewer.tsx +++ b/web/src/components/traffic-evidence-viewer.tsx @@ -16,6 +16,26 @@ import { Skeleton } from "@/components/ui/skeleton"; import { api } from "@/lib/api"; import type { FindingTrafficDetail, TrafficDetail } from "@/lib/types"; +function formatCapturedAt(value: number | string | null | undefined) { + if (value === null || value === undefined || value === "") return ""; + const numeric = typeof value === "number" ? value : Number(value); + const date = Number.isFinite(numeric) + ? new Date(numeric < 10_000_000_000 ? numeric * 1000 : numeric) + : new Date(String(value)); + if (Number.isNaN(date.getTime())) return ""; + return new Intl.DateTimeFormat("zh-CN", { + year: "numeric", + month: "2-digit", + day: "2-digit", + hour: "2-digit", + minute: "2-digit", + second: "2-digit", + hour12: false, + }) + .format(date) + .replace(/\//g, "-"); +} + export function TrafficEvidenceViewer({ findingId, bindingId, @@ -97,9 +117,16 @@ export function TrafficEvidenceViewer({