Refactor task audits, integrate OpenClaw, and fix timezone handling
This commit is contained in:
+19
-4
@@ -74,21 +74,36 @@ function SourceTag({ source }) {
|
||||
);
|
||||
}
|
||||
|
||||
function getSafeTimezone() {
|
||||
const tz = window.workspace ? window.workspace.timezone : undefined;
|
||||
if (!tz) return undefined;
|
||||
try {
|
||||
Intl.DateTimeFormat(undefined, { timeZone: tz });
|
||||
return tz;
|
||||
} catch (e) {
|
||||
return undefined; // Fallback to browser time if invalid
|
||||
}
|
||||
}
|
||||
|
||||
function relTime(iso) {
|
||||
const now = new Date('2026-05-08T10:30:00');
|
||||
if (typeof iso === 'string' && !iso.endsWith('Z') && !iso.includes('+')) iso += 'Z';
|
||||
const now = new Date();
|
||||
const then = new Date(iso);
|
||||
const diff = (now - then) / 1000;
|
||||
if (diff < 60) return 'just now';
|
||||
if (diff < 3600) return Math.floor(diff/60) + 'm ago';
|
||||
if (diff < 86400) return Math.floor(diff/3600) + 'h ago';
|
||||
if (diff < 86400*7) return Math.floor(diff/86400) + 'd ago';
|
||||
return then.toLocaleDateString('en-US', { month: 'short', day: 'numeric' });
|
||||
|
||||
return then.toLocaleDateString('en-US', { month: 'short', day: 'numeric', timeZone: getSafeTimezone() });
|
||||
}
|
||||
|
||||
function fmtDateTime(iso) {
|
||||
if (typeof iso === 'string' && !iso.endsWith('Z') && !iso.includes('+')) iso += 'Z';
|
||||
const d = new Date(iso);
|
||||
return d.toLocaleDateString('en-US', { month: 'short', day: 'numeric' }) +
|
||||
' · ' + d.toLocaleTimeString('en-US', { hour: 'numeric', minute: '2-digit' });
|
||||
const tz = getSafeTimezone();
|
||||
return d.toLocaleDateString('en-US', { month: 'short', day: 'numeric', timeZone: tz }) +
|
||||
' · ' + d.toLocaleTimeString('en-US', { hour: 'numeric', minute: '2-digit', timeZone: tz });
|
||||
}
|
||||
|
||||
function findUser(id) {
|
||||
|
||||
Reference in New Issue
Block a user