From 2b8450951e942584973a5dda9ab6353ae28ca55c Mon Sep 17 00:00:00 2001 From: Will Bradley Date: Wed, 16 Jul 2025 13:27:50 -0700 Subject: [PATCH] Time zones and server listen host --- public/dashboard.html | 7 +++++-- server.js | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/public/dashboard.html b/public/dashboard.html index f47c9eb..3f7ae93 100644 --- a/public/dashboard.html +++ b/public/dashboard.html @@ -365,9 +365,11 @@ function formatTimeAgo(dateString) { if (!dateString) return 'Never'; - const date = new Date(dateString); + // Parse UTC timestamp correctly + const date = new Date(dateString + (dateString.includes('Z') ? '' : 'Z')); const now = new Date(); const diffInSeconds = Math.floor((now - date) / 1000); + console.log(date,now,diffInSeconds); if (diffInSeconds < 60) { return 'Just now'; @@ -389,7 +391,8 @@ function formatTimeUntil(dateString) { if (!dateString) return 'Unknown'; - const date = new Date(dateString); + // Parse UTC timestamp correctly + const date = new Date(dateString + (dateString.includes('Z') ? '' : 'Z')); const now = new Date(); const diffInSeconds = Math.floor((date - now) / 1000); diff --git a/server.js b/server.js index d0f40e1..a08ed67 100644 --- a/server.js +++ b/server.js @@ -12,6 +12,7 @@ const path = require('path'); require('dotenv').config(); const app = express(); +const HOST = process.env.HOST || "0.0.0.0"; const PORT = process.env.PORT || 3000; // Database setup @@ -453,6 +454,6 @@ app.get('/login', (req, res) => { res.sendFile(path.join(__dirname, 'public', 'login.html')); }); -app.listen(PORT, () => { - console.log(`Server running on port ${PORT}`); +app.listen(PORT, HOST, () => { + console.log(`Server running on http://${HOST}:${PORT}`); }); \ No newline at end of file