From dbf59e42a8783dcfcff01f9aac5588767a850b2f Mon Sep 17 00:00:00 2001 From: Will Bradley Date: Wed, 16 Jul 2025 18:26:26 -0700 Subject: [PATCH] Round hour values instead of floor --- public/dashboard.html | 12 ++++++------ public/index.html | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/public/dashboard.html b/public/dashboard.html index 6104a15..ab239a8 100644 --- a/public/dashboard.html +++ b/public/dashboard.html @@ -378,13 +378,13 @@ if (diffInSeconds < 60) { return 'Just now'; } else if (diffInSeconds < 3600) { - const minutes = Math.floor(diffInSeconds / 60); + const minutes = Math.round(diffInSeconds / 60); return `${minutes} minute${minutes !== 1 ? 's' : ''} ago`; } else if (diffInSeconds < 86400) { - const hours = Math.floor(diffInSeconds / 3600); + const hours = Math.round(diffInSeconds / 3600); return `${hours} hour${hours !== 1 ? 's' : ''} ago`; } else if (diffInSeconds < 604800) { - const days = Math.floor(diffInSeconds / 86400); + const days = Math.round(diffInSeconds / 86400); return `${days} day${days !== 1 ? 's' : ''} ago`; } else { return date.toLocaleDateString() + ' at ' + date.toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'}); @@ -403,13 +403,13 @@ if (diffInSeconds <= 0) { return 'Already empty'; } else if (diffInSeconds < 3600) { - const minutes = Math.floor(diffInSeconds / 60); + const minutes = Math.round(diffInSeconds / 60); return `${minutes} minute${minutes !== 1 ? 's' : ''}`; } else if (diffInSeconds < 86400) { - const hours = Math.floor(diffInSeconds / 3600); + const hours = Math.round(diffInSeconds / 3600); return `${hours} hour${hours !== 1 ? 's' : ''}`; } else { - const days = Math.floor(diffInSeconds / 86400); + const days = Math.round(diffInSeconds / 86400); return `${days} day${days !== 1 ? 's' : ''}`; } } diff --git a/public/index.html b/public/index.html index df6f53f..0ff145b 100644 --- a/public/index.html +++ b/public/index.html @@ -301,13 +301,13 @@ if (diffInSeconds < 60) { return 'Just now'; } else if (diffInSeconds < 3600) { - const minutes = Math.floor(diffInSeconds / 60); + const minutes = Math.round(diffInSeconds / 60); return `${minutes} minute${minutes !== 1 ? 's' : ''} ago`; } else if (diffInSeconds < 86400) { - const hours = Math.floor(diffInSeconds / 3600); + const hours = Math.round(diffInSeconds / 3600); return `${hours} hour${hours !== 1 ? 's' : ''} ago`; } else if (diffInSeconds < 604800) { - const days = Math.floor(diffInSeconds / 86400); + const days = Math.round(diffInSeconds / 86400); return `${days} day${days !== 1 ? 's' : ''} ago`; } else { return date.toLocaleDateString() + ' at ' + date.toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'}); @@ -326,13 +326,13 @@ if (diffInSeconds <= 0) { return 'Already empty'; } else if (diffInSeconds < 3600) { - const minutes = Math.floor(diffInSeconds / 60); + const minutes = Math.round(diffInSeconds / 60); return `${minutes} minute${minutes !== 1 ? 's' : ''}`; } else if (diffInSeconds < 86400) { - const hours = Math.floor(diffInSeconds / 3600); + const hours = Math.round(diffInSeconds / 3600); return `${hours} hour${hours !== 1 ? 's' : ''}`; } else { - const days = Math.floor(diffInSeconds / 86400); + const days = Math.round(diffInSeconds / 86400); return `${days} day${days !== 1 ? 's' : ''}`; } }