summaryrefslogtreecommitdiffhomepage
path: root/src/features/workspaces/logic/view-model.ts
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-09-07 18:00:14 +0900
committerAdam Malczewski <[email protected]>2026-09-07 18:00:14 +0900
commit61733924352285df6c44f66edf69ea6f738fae3e (patch)
treeef607006b55002e988b1e37cb3680b28f087482c /src/features/workspaces/logic/view-model.ts
parent48b23a8132537209c338aa04311f8057b1f5f5b5 (diff)
downloaddispatch-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.ts')
-rw-r--r--src/features/workspaces/logic/view-model.ts10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/features/workspaces/logic/view-model.ts b/src/features/workspaces/logic/view-model.ts
index 0b9f239..6f5a635 100644
--- a/src/features/workspaces/logic/view-model.ts
+++ b/src/features/workspaces/logic/view-model.ts
@@ -96,10 +96,8 @@ export function relativeTime(then: number, now: number): string {
const hours = Math.floor(mins / 60);
if (hours < 24) return `${hours}h`;
const days = Math.floor(hours / 24);
- if (days < 7) return `${days}d`;
- // Beyond a week: a short date (MM/DD). Uses UTC parts for determinism in tests.
- const d = new Date(then);
- const month = String(d.getUTCMonth() + 1).padStart(2, "0");
- const day = String(d.getUTCDate()).padStart(2, "0");
- return `${month}/${day}`;
+ if (days < 30) return `${days}d`;
+ // Past a month: months (a month ≈ 30 days). No short date — the label
+ // stays relative forever.
+ return `${Math.floor(days / 30)}mo`;
}