diff --git a/public/admin.js b/public/admin.js index 378c82f..5a20dce 100644 --- a/public/admin.js +++ b/public/admin.js @@ -495,7 +495,7 @@ document.addEventListener('DOMContentLoaded', () => { function getTimeAgo(timestamp) { const now = new Date(); // Ensure timestamp is treated as UTC if it doesn't have timezone info - const reportTime = new Date(timestamp.includes('T') ? timestamp : timestamp + 'Z'); + const reportTime = parseUTCDate(timestamp); const diffInMinutes = Math.floor((now - reportTime) / (1000 * 60)); if (diffInMinutes < 1) return 'just now'; @@ -510,6 +510,11 @@ document.addEventListener('DOMContentLoaded', () => { return reportTime.toLocaleDateString(); } + // Helper function to parse UTC date + function parseUTCDate(timestamp) { + return new Date(timestamp.includes('T') ? timestamp : timestamp + 'Z'); + } + // Profanity management functions async function loadProfanityWords() { if (!profanityTableBody) return; diff --git a/public/app-google.js b/public/app-google.js index 89012ef..1db2981 100644 --- a/public/app-google.js +++ b/public/app-google.js @@ -82,9 +82,15 @@ document.addEventListener('DOMContentLoaded', async () => { }); }; + // Helper function to parse UTC date + const parseUTCDate = (timestamp) => { + return new Date(timestamp.includes('T') ? timestamp : timestamp + 'Z'); + }; + 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 = parseUTCDate(timestamp); 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 6723788..dcff11f 100644 --- a/public/app-mapbox.js +++ b/public/app-mapbox.js @@ -93,10 +93,15 @@ document.addEventListener('DOMContentLoaded', async () => { }); }; + // Helper function to parse UTC date + const parseUTCDate = (timestamp) => { + return new Date(timestamp.includes('T') ? timestamp : timestamp + 'Z'); + }; + const getTimeAgo = (timestamp) => { const now = new Date(); // Ensure timestamp is treated as UTC if it doesn't have timezone info - const reportTime = new Date(timestamp.includes('T') ? timestamp : timestamp + 'Z'); + const reportTime = parseUTCDate(timestamp); const diffInMinutes = Math.floor((now - reportTime) / (1000 * 60)); if (diffInMinutes < 1) return 'just now'; @@ -174,7 +179,7 @@ document.addEventListener('DOMContentLoaded', async () => { const now = new Date(); // Ensure timestamp is treated as UTC if it doesn't have timezone info - const reportTime = new Date(timestamp.includes('T') ? timestamp : timestamp + 'Z'); + const reportTime = parseUTCDate(timestamp); const expirationTime = new Date(reportTime.getTime() + 48 * 60 * 60 * 1000); const remaining = expirationTime - now; @@ -198,7 +203,7 @@ document.addEventListener('DOMContentLoaded', async () => { const now = new Date(); // Ensure timestamp is treated as UTC if it doesn't have timezone info - const reportTime = new Date(timestamp.includes('T') ? timestamp : timestamp + 'Z'); + const reportTime = parseUTCDate(timestamp); const expirationTime = new Date(reportTime.getTime() + 48 * 60 * 60 * 1000); const remaining = expirationTime - now; const hoursRemaining = remaining / (1000 * 60 * 60); diff --git a/public/app.js b/public/app.js index 421bfdb..84d0933 100644 --- a/public/app.js +++ b/public/app.js @@ -74,9 +74,15 @@ document.addEventListener('DOMContentLoaded', () => { }); }; + // Helper function to parse UTC date + const parseUTCDate = (timestamp) => { + return new Date(timestamp.includes('T') ? timestamp : timestamp + 'Z'); + }; + 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 = parseUTCDate(timestamp); const diffInMinutes = Math.floor((now - reportTime) / (1000 * 60)); if (diffInMinutes < 1) return 'just now';