@devries-cameron20 / t3code-1 / commits / a27b246162
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(web): usage-limit banner reset time follows the Time format setting (#22915)

Co-authored-by: Victor Vogel <satsdev@only21mil.xyz> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Theo Browne committed Oct 25, 2026 at 15:09 UTC a27b246162a895cc94f96925c361ab73b094154e
3 files changed +42 -2
apps/web/src/components/ChatView.tsx
+1
@@ -2578,6 +2578,7 @@ export default function ChatView(props: ChatViewProps) {
2578 stoppedAt: activeThreadShell.latestRun.completedAt ?? activeThreadShell.updatedAt,
2579 recovery: activeThreadShell.limitRecovery ?? null,
2580 snoozedUntil: activeThreadShell.snoozedUntil,
2581 + timestampFormat,
2582 onChange: async (limitRecovery) => {
2583 const result = await updateThreadMetadata({
2584 environmentId,
apps/web/src/components/chat/UsageLimitRecoveryBanner.test.tsx new
+36
@@ -0,0 +1,36 @@
1 +import { RunId } from "@t3tools/contracts";
2 +import type { TimestampFormat } from "@t3tools/contracts/settings";
3 +import { describe, expect, it, vi } from "vite-plus/test";
4 +
5 +import { usageLimitRecoveryBannerItem } from "./UsageLimitRecoveryBanner";
6 +
7 +const stoppedAt = new Date(2026, 9, 20, 12, 0);
8 +
9 +function bannerDescription(resetAt: Date, timestampFormat: TimestampFormat) {
10 + return usageLimitRecoveryBannerItem({
11 + runId: RunId.make("run-1"),
12 + resetAt: resetAt.toISOString(),
13 + stoppedAt: stoppedAt.toISOString(),
14 + snoozedUntil: null,
15 + recovery: null,
16 + timestampFormat,
17 + onChange: async () => {},
18 + }).description;
19 +}
20 +
21 +describe("usageLimitRecoveryBannerItem", () => {
22 + it.each([
23 + ["12-hour", "Resets 5:30 PM"],
24 + ["24-hour", "Resets 17:30"],
25 + ] as const)("formats a same-day reset with the %s setting", (timestampFormat, expected) => {
26 + using _now = vi.spyOn(Date, "now").mockReturnValue(stoppedAt.getTime());
27 + expect(bannerDescription(new Date(2026, 9, 20, 17, 30), timestampFormat)).toBe(expected);
28 + });
29 +
30 + it("names the day when the reset is tomorrow", () => {
31 + using _now = vi.spyOn(Date, "now").mockReturnValue(stoppedAt.getTime());
32 + expect(bannerDescription(new Date(2026, 9, 21, 17, 30), "24-hour")).toBe(
33 + "Resets tomorrow at 17:30",
34 + );
35 + });
36 +});
apps/web/src/components/chat/UsageLimitRecoveryBanner.tsx
+5 -2
@@ -3,9 +3,11 @@ import {
3 type OrchestrationV2LimitRecoveryUpdate,
4 type RunId,
5 } from "@t3tools/contracts";
6 +import { type TimestampFormat } from "@t3tools/contracts/settings";
7 import { GaugeIcon } from "lucide-react";
8 import { useEffect, useState } from "react";
9 import { Button } from "../ui/button";
10 +import { formatUpcomingTimestamp } from "../../timestampFormat";
11 import { toastManager } from "../ui/toast";
12 import type { ComposerBannerStackItem } from "./ComposerBannerStack";
13
@@ -15,11 +17,12 @@ type RecoveryProps = {
17 stoppedAt: string;
18 snoozedUntil: string | null;
19 recovery: OrchestrationV2LimitRecovery | null;
20 + timestampFormat: TimestampFormat;
21 onChange: (recovery: OrchestrationV2LimitRecoveryUpdate) => Promise<void>;
22 };
23
24 export function usageLimitRecoveryBannerItem(props: RecoveryProps): ComposerBannerStackItem {
22 - const { runId, resetAt, stoppedAt } = props;
25 + const { runId, resetAt, stoppedAt, timestampFormat } = props;
26 const canSchedule = resetAt !== null && Date.parse(resetAt) > Date.parse(stoppedAt);
27 return {
28 id: `usage-limit-recovery:${runId}`,
@@ -28,7 +31,7 @@ export function usageLimitRecoveryBannerItem(props: RecoveryProps): ComposerBann
31 icon: <GaugeIcon />,
32 title: "Usage limit reached",
33 description: resetAt
31 - ? `Resets ${new Date(resetAt).toLocaleString()}`
34 + ? `Resets ${formatUpcomingTimestamp(resetAt, timestampFormat)}`
35 : "Reset time unavailable; retry manually",
36 actions: canSchedule ? <RecoveryActions key={`${runId}:${resetAt}`} {...props} /> : null,
37 };