Skip to content

Commit 0b2a3ac

Browse files
committed
format timestamp display using a helper function for consistency
1 parent 60f99f0 commit 0b2a3ac

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

templates/main.tmpl

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@
344344
li.className = `request-link block p-4 hover:bg-gray-50 ${currentViewId == request.ID ? 'bg-indigo-50 border-l-4 border-indigo-500' : ''}`;
345345

346346
const methodColor = getMethodColor(request.Method);
347-
const timestamp = new Date(request.Timestamp).toLocaleString();
347+
const timestamp = formatTime(request.Timestamp);
348348

349349
li.innerHTML = `
350350
<div class="flex justify-between items-center mb-1">
@@ -393,6 +393,18 @@
393393
}
394394
}
395395

396+
// Helper function to format time in the same format as server-side formatTime
397+
function formatTime(dateString) {
398+
const date = new Date(dateString);
399+
const year = date.getFullYear();
400+
const month = String(date.getMonth() + 1).padStart(2, '0');
401+
const day = String(date.getDate()).padStart(2, '0');
402+
const hours = String(date.getHours()).padStart(2, '0');
403+
const minutes = String(date.getMinutes()).padStart(2, '0');
404+
const seconds = String(date.getSeconds()).padStart(2, '0');
405+
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
406+
}
407+
396408
// Pagination button event listeners
397409
prevPageBtn.addEventListener('click', () => {
398410
if (currentPage > 1) {

0 commit comments

Comments
 (0)