diff --git a/public/admin.js b/public/admin.js index 0eb9d38..378c82f 100644 --- a/public/admin.js +++ b/public/admin.js @@ -494,7 +494,8 @@ document.addEventListener('DOMContentLoaded', () => { function getTimeAgo(timestamp) { const now = new Date(); - const reportTime = new Date(timestamp); + // Ensure timestamp is treated as UTC if it doesn't have timezone info + const reportTime = new Date(timestamp.includes('T') ? timestamp : timestamp + 'Z'); const diffInMinutes = Math.floor((now - reportTime) / (1000 * 60)); if (diffInMinutes < 1) return 'just now'; diff --git a/public/app-mapbox.js b/public/app-mapbox.js index dcd4dce..6723788 100644 --- a/public/app-mapbox.js +++ b/public/app-mapbox.js @@ -95,7 +95,8 @@ document.addEventListener('DOMContentLoaded', async () => { const getTimeAgo = (timestamp) => { const now = new Date(); - const reportTime = new Date(timestamp); + // Ensure timestamp is treated as UTC if it doesn't have timezone info + const reportTime = new Date(timestamp.includes('T') ? timestamp : timestamp + 'Z'); const diffInMinutes = Math.floor((now - reportTime) / (1000 * 60)); if (diffInMinutes < 1) return 'just now'; @@ -172,7 +173,8 @@ document.addEventListener('DOMContentLoaded', async () => { } const now = new Date(); - const reportTime = new Date(timestamp); + // Ensure timestamp is treated as UTC if it doesn't have timezone info + const reportTime = new Date(timestamp.includes('T') ? timestamp : timestamp + 'Z'); const expirationTime = new Date(reportTime.getTime() + 48 * 60 * 60 * 1000); const remaining = expirationTime - now; @@ -195,7 +197,8 @@ document.addEventListener('DOMContentLoaded', async () => { } const now = new Date(); - const reportTime = new Date(timestamp); + // Ensure timestamp is treated as UTC if it doesn't have timezone info + const reportTime = new Date(timestamp.includes('T') ? timestamp : timestamp + 'Z'); const expirationTime = new Date(reportTime.getTime() + 48 * 60 * 60 * 1000); const remaining = expirationTime - now; const hoursRemaining = remaining / (1000 * 60 * 60);