Fix timezone formatting fallback by normalizing timestamps

This commit is contained in:
nmemmert committed 2025-12-15 16:14:04 -05:00
1 parent 3235ae3789
commit 49cd477991
7 files changed
+15 -9

No files matched your search

+7 -1
View File
@@ -16,7 +16,13 @@ export const getCurrentTimezone = () => {
export const formatLocalTime = (timestamp, options = {}) => {
if (!timestamp) return 'Never';
const date = new Date(timestamp);
// Normalize timestamp to ISO if backend returned space-separated datetime
let ts = timestamp;
if (typeof ts === 'string' && ts.includes(' ') && !ts.includes('T')) {
ts = ts.replace(' ', 'T') + 'Z';
}
const date = new Date(ts);
// Try to get server timezone from settings API response (cached in localStorage)
let timeZone;