Skip to content

Commit eab661e

Browse files
fix: timestamp fallback
1 parent 63ac02b commit eab661e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

gui/src/components/BackgroundMode/AgentsList.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,15 @@ function AgentStatusBadge({ status }: { status: string }) {
295295
function formatRelativeTime(dateString: string): string {
296296
try {
297297
const date = new Date(dateString);
298+
const timestamp = date.getTime();
299+
300+
// Guard against invalid dates (NaN)
301+
if (isNaN(timestamp)) {
302+
return dateString;
303+
}
304+
298305
const now = new Date();
299-
const diffMs = now.getTime() - date.getTime();
306+
const diffMs = now.getTime() - timestamp;
300307
const diffMins = Math.floor(diffMs / 60000);
301308
const diffHours = Math.floor(diffMs / 3600000);
302309
const diffDays = Math.floor(diffMs / 86400000);

0 commit comments

Comments
 (0)