mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-03 13:54:11 +00:00
fix(ui): guard debug event timestamps
This commit is contained in:
@@ -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");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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)}</pre
|
||||
<div class="list-item debug-event-log__item">
|
||||
<div class="list-main">
|
||||
<div class="list-title">${evt.event}</div>
|
||||
<div class="list-sub">${new Date(evt.ts).toLocaleTimeString()}</div>
|
||||
<div class="list-sub">${formatTimeMs(evt.ts, undefined, "")}</div>
|
||||
</div>
|
||||
<div class="list-meta debug-event-log__meta">
|
||||
<pre class="code-block debug-event-log__payload">
|
||||
|
||||
Reference in New Issue
Block a user