Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/client-runtime/src/state/threadSettled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,9 @@ export function snoozeWakeLabel(snoozedUntil: string, options: { readonly now: s
if (Number.isNaN(wakeMs) || Number.isNaN(nowMs)) return "now";
const remainingMs = wakeMs - nowMs;
if (remainingMs <= 0) return "now";
if (remainingMs < HOUR_MS) return `${Math.max(1, Math.ceil(remainingMs / 60_000))}m`;
if (remainingMs < DAY_MS) return `${Math.ceil(remainingMs / HOUR_MS)}h`;
const remainingMinutes = Math.ceil(remainingMs / 60_000);
if (remainingMinutes < 60) return `${Math.max(1, remainingMinutes)}m`;
const remainingHours = Math.ceil(remainingMs / HOUR_MS);
if (remainingHours < 24) return `${remainingHours}h`;
return `${Math.ceil(remainingMs / DAY_MS)}d`;
}
5 changes: 5 additions & 0 deletions packages/client-runtime/src/state/threadSnoozed.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,11 @@ describe("snoozeWakeLabel", () => {
expect(snoozeWakeLabel("2026-06-03T02:00:00.000Z", { now })).toBe("2d");
});

it("promotes rounded values at unit boundaries", () => {
expect(snoozeWakeLabel("2026-06-02T00:59:59.999Z", { now })).toBe("1h");
expect(snoozeWakeLabel("2026-06-02T23:59:59.999Z", { now })).toBe("1d");
});

it("never reads zero or negative while still snoozed", () => {
expect(snoozeWakeLabel("2026-06-02T00:00:30.000Z", { now })).toBe("1m");
expect(snoozeWakeLabel("2026-06-01T23:59:59.000Z", { now })).toBe("now");
Expand Down
Loading