Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/cli/ui/components/messageList/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Expected Impact: Reduces string allocations and padding operations per render cycle
const PADDED_NUMBERS = Array.from({ length: 60 }, (_, i) => String(i).padStart(2, '0'));

export function formatTime(timestamp: Date): string {
const hours = String(timestamp.getHours()).padStart(2, '0');
const minutes = String(timestamp.getMinutes()).padStart(2, '0');
const seconds = String(timestamp.getSeconds()).padStart(2, '0');
const hours = PADDED_NUMBERS[timestamp.getHours()];
const minutes = PADDED_NUMBERS[timestamp.getMinutes()];
const seconds = PADDED_NUMBERS[timestamp.getSeconds()];
return `${hours}:${minutes}:${seconds}`;
}
Loading