diff --git a/src/App.tsx b/src/App.tsx index f55d4c9..6ece149 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -133,9 +133,13 @@ function App() { return hours.toLocaleString() } - // Format time ago from timestamp + // Format time ago from timestamp (API returns UTC timestamps) const formatTimeAgo = (timestamp: number) => { - const seconds = Math.floor((Date.now() - timestamp) / 1000) + const now = Date.now() // Current local time + const utcNow = now - (new Date().getTimezoneOffset() * 60000) // Convert to UTC + const seconds = Math.floor((utcNow - timestamp) / 1000) + + if (seconds < 0) return 'just now' // Future timestamp if (seconds < 60) return `${seconds}s ago` const minutes = Math.floor(seconds / 60) if (minutes < 60) return `${minutes}m ago`