feat(sessions): show calendar dates with relative time and enable dat… - #556
Conversation
tt-a1i
left a comment
There was a problem hiding this comment.
审查提交:f0fdbee361a7b4bb76adc4dd31aeb26e0bbde22f。
需要修改后再合并。
具体问题
P2 — 依赖真实时钟的日期测试每天凌晨必然失败 · tests/extensions/sessions/sessions.test.ts:151
Freeze Asia/Shanghai clock at 2026-09-21 00:05: test expects HH:mm (10m ago), gets 09-20 (0d ago). 6 pass / 1 fail. Also cross-year assumptions affect January.
验证范围
Complete two-file diff reviewed; deterministic frozen-clock reproduction saved in test-midnight.log.
限制与后续
No real TUI acceptance; yesterday 0d label is an additional UX ambiguity, not separately escalated.
f0fdbee to
8112d6e
Compare
tt-a1i
left a comment
There was a problem hiding this comment.
复审提交 8112d6e6b872c499c9debcd185488876217c6358。
此前的确定性问题已修复:格式化函数接收显式时钟,测试固定了普通、跨午夜和跨年边界,不再依赖运行时当天日期。当前所有远端检查通过,未发现新的阻断问题。
当前语义按经过时长划分:不足 24 小时即使跨过午夜仍显示 HH:mm,而不是按日历日立即切为 MM-DD。这是当前实现和新增断言明确选择的行为;如果产品要求“昨天一律显示日期”,需要另行调整,但不再是测试偶发问题。未执行真实 TUI 目视验收。
Summary
This PR improves the session timestamp presentation and searchability in
/sessions:Yesterdayvs3d ago) with a unified two-part format:HH:MM (Xm/Xh ago)(e.g.14:30 (2h ago))MM-DD (Xd ago)(e.g.09-06 (12d ago)), orYYYY-MMacross years.HH:MMandMM-DD) maintains a strictly aligned 5-character width.buildSearchText, allowing users to filter sessions by year, month, or calendar date (e.g.typing
2026or09-).tests/extensions/sessions/sessions.test.ts.Testing
node --test --experimental-strip-types tests/extensions/sessions/*.test.ts(11 passed, 0 failed)