diff --git a/ui/src/ui/views/debug.test.ts b/ui/src/ui/views/debug.test.ts index 7fedbbf8bb9..7160336671a 100644 --- a/ui/src/ui/views/debug.test.ts +++ b/ui/src/ui/views/debug.test.ts @@ -72,4 +72,26 @@ describe("renderDebug", () => { ); expect(command.textContent).toBe("openclaw security audit --deep"); }); + + it("does not render Invalid Date for Date-invalid event timestamps", () => { + const container = document.createElement("div"); + + render( + renderDebug( + createProps({ + eventLog: [ + { + ts: 8_640_000_000_000_001, + event: "gateway", + payload: { ok: true }, + }, + ], + }), + ), + container, + ); + + expect(container.textContent).toContain("gateway"); + expect(container.textContent).not.toContain("Invalid Date"); + }); }); diff --git a/ui/src/ui/views/debug.ts b/ui/src/ui/views/debug.ts index ac1946960f0..51b9cc9d4e2 100644 --- a/ui/src/ui/views/debug.ts +++ b/ui/src/ui/views/debug.ts @@ -1,6 +1,7 @@ import { html, nothing } from "lit"; import { t } from "../../i18n/index.ts"; import type { EventLogEntry } from "../app-events.ts"; +import { formatTimeMs } from "../format.ts"; import { formatEventPayload } from "../presenter.ts"; export type DebugProps = { @@ -136,7 +137,7 @@ ${JSON.stringify(props.models ?? [], null, 2)}
${evt.event}
-
${new Date(evt.ts).toLocaleTimeString()}
+
${formatTimeMs(evt.ts, undefined, "")}