fix(FN-927): always show relative duration for CLI reset times

The guard `if (!window.resetText)` prevented overwriting the raw CLI
text (e.g. "Resets Apr 9 at 8pm") with a relative duration because
resetText was already populated from the parsed CLI line. Remove the
guard so the parsed date is always converted to "resets in 3d 8h".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-04-04 14:20:32 -07:00
parent 83b709b4e6
commit d2bfe56874

View File

@@ -655,9 +655,9 @@ async function fetchClaudeUsageViaCli(): Promise<ProviderUsage> {
const msLeft = new Date(iso).getTime() - Date.now();
window.resetMs = msLeft > 0 ? msLeft : 0;
window.resetAt = iso;
if (!window.resetText) {
window.resetText = msLeft > 0 ? `resets in ${formatDuration(msLeft)}` : "resetting now";
}
// Always replace raw CLI text (e.g. "Resets Apr 9 at 8pm") with
// a relative duration (e.g. "resets in 3d 8h") for better UX.
window.resetText = msLeft > 0 ? `resets in ${formatDuration(msLeft)}` : "resetting now";
}
}