diff options
| author | Adam Malczewski <[email protected]> | 2026-09-07 18:00:14 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-09-07 18:00:14 +0900 |
| commit | 61733924352285df6c44f66edf69ea6f738fae3e (patch) | |
| tree | ef607006b55002e988b1e37cb3680b28f087482c /src/features/workspaces/logic/view-model.test.ts | |
| parent | 48b23a8132537209c338aa04311f8057b1f5f5b5 (diff) | |
| download | dispatch-web-61733924352285df6c44f66edf69ea6f738fae3e.tar.gz dispatch-web-61733924352285df6c44f66edf69ea6f738fae3e.zip | |
feat(workspaces): tile stat line shows months instead of a short date
The relative last-activity time switched to an MM/DD date once past a week.
Now it stays relative: days continue to a month (30 days), then months
("10d", "29d", "1mo", "2mo", ...). A month ≈ 30 days; the label never
becomes an absolute date.
Verification: svelte-check 0 errors/0 warnings; vitest 1694/1694; biome
clean on touched files; build ok.
Diffstat (limited to 'src/features/workspaces/logic/view-model.test.ts')
| -rw-r--r-- | src/features/workspaces/logic/view-model.test.ts | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/features/workspaces/logic/view-model.test.ts b/src/features/workspaces/logic/view-model.test.ts index d283481..d13f485 100644 --- a/src/features/workspaces/logic/view-model.test.ts +++ b/src/features/workspaces/logic/view-model.test.ts @@ -49,10 +49,15 @@ describe("relativeTime", () => { expect(relativeTime(now - 3 * 24 * 60 * 60_000, now)).toBe("3d"); }); - it("is a short date beyond a week", () => { - // 7+ days ago: just check it is a MM/DD string. - const s = relativeTime(now - 10 * 24 * 60 * 60_000, now); - expect(s).toMatch(/^\d{2}\/\d{2}$/); + it("keeps days past a week (no short date) up to a month", () => { + expect(relativeTime(now - 10 * 24 * 60 * 60_000, now)).toBe("10d"); + expect(relativeTime(now - 29 * 24 * 60 * 60_000, now)).toBe("29d"); + }); + + it("is months past a month", () => { + expect(relativeTime(now - 30 * 24 * 60 * 60_000, now)).toBe("1mo"); + expect(relativeTime(now - 75 * 24 * 60 * 60_000, now)).toBe("2mo"); + expect(relativeTime(now - 365 * 24 * 60 * 60_000, now)).toBe("12mo"); }); }); |
