feat(app): 事件流时间加上日期——HH:MM:SS → MM-DD HH:MM:SS(本地时区,仅事件流)

新增 DATETIME 格式化器用于 adaptEvent,agent 面板的 TIME 保持不动。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
wangjia
2026-06-29 05:44:26 +08:00
parent 2009627eda
commit a50e45baba
+9 -1
View File
@@ -92,6 +92,14 @@ export function adaptApproval(tk, projName) {
// ── 事件流 ─────────────────────────────────────────────
const TIME = (iso) => { try { return new Date(iso).toTimeString().slice(0, 8); } catch { return ''; } };
// 事件流时间带日期(本地时区):MM-DD HH:MM:SS
const DATETIME = (iso) => {
try {
const d = new Date(iso);
const p = (n) => String(n).padStart(2, '0');
return `${p(d.getMonth() + 1)}-${p(d.getDate())} ${TIME(iso)}`;
} catch { return ''; }
};
export function adaptEvent(e) {
const p = e.payload || {};
@@ -106,7 +114,7 @@ export function adaptEvent(e) {
case 'project.synced': detail = `导入 ${p.created ?? 0} · 完成 ${p.done ?? 0}`; break;
default: detail = JSON.stringify(p).slice(0, 80);
}
return { type: e.type, time: TIME(e.at), detail };
return { type: e.type, time: DATETIME(e.at), detail };
}
// ── 用量 / 配额 ────────────────────────────────────────