Merge pull request #1440 from kaitranntt/codex/fix-log-detail-panel-timestamp-handling

fix(ui): guard invalid log detail timestamps
This commit is contained in:
Kai (Tam Nhu) Tran authored and GitHub committed 2026-05-30 15:46:14 -04:00
commit 80fcb54c67
3 files changed
+42 -1

No files matched your search

+2 -1
View File
@@ -9,6 +9,7 @@ import { LogLevelBadge } from './log-level-badge';
import { LogsEmpty } from './logs-empty';
import {
formatJson,
formatLogTimestampIso,
getDisplayLatency,
getDisplayModule,
getDisplayRequestId,
@@ -34,7 +35,7 @@ interface OverviewRow {
function buildOverviewRows(entry: LogsEntry, sourceLabel?: string): OverviewRow[] {
// Use shared accessors so this panel and the list row never diverge.
return [
{ label: 'Time', value: new Date(entry.timestamp).toISOString(), mono: true },
{ label: 'Time', value: formatLogTimestampIso(entry.timestamp), mono: true },
{ label: 'Level', value: entry.level },
{ label: 'Module', value: getDisplayModule(entry, sourceLabel) },
{ label: 'Stage', value: getDisplayStage(entry) },
+13
View File
@@ -21,6 +21,19 @@ export function formatLogTimestamp(timestamp: string | null | undefined) {
}).format(date);
}
export function formatLogTimestampIso(timestamp: string | null | undefined) {
if (!timestamp) {
return 'No activity yet';
}
const date = new Date(timestamp);
if (Number.isNaN(date.getTime())) {
return timestamp;
}
return date.toISOString();
}
export function formatRelativeLogTime(timestamp: string | null | undefined) {
if (!timestamp) {
return 'No activity yet';