Skip to content

Commit 25f596b

Browse files
Copilotphrocker
andauthored
Fix negative last evaluated times on trust scores page (#173)
* Initial plan * Fix negative last evaluated times in trust scores page Co-authored-by: phrocker <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: phrocker <[email protected]>
1 parent f00a8a0 commit 25f596b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

api/src/main/resources/templates/sso/trust_scores.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,11 @@ <h5 class="card-title">${score.agentName || score.agentId}</h5>
220220
const diffMs = now - date;
221221
const diffMins = Math.floor(diffMs / 60000);
222222

223-
if (diffMins < 60) return `${diffMins} minutes ago`;
224-
if (diffMins < 1440) return `${Math.floor(diffMins / 60)} hours ago`;
223+
// Handle future timestamps or very recent (within 1 minute)
224+
if (diffMins <= 0) return 'just now';
225+
if (diffMins < 60) return `${diffMins} minute${diffMins === 1 ? '' : 's'} ago`;
226+
const diffHours = Math.floor(diffMins / 60);
227+
if (diffMins < 1440) return `${diffHours} hour${diffHours === 1 ? '' : 's'} ago`;
225228
return date.toLocaleString();
226229
}
227230

0 commit comments

Comments
 (0)