feat: show exact reset times instead of relative durations#13
Conversation
03u4nc
commented
Mar 6, 2026
- Change "Resets In" column to "Resets At" with exact clock times (e.g. "11:17 AM" instead of "3h 53m")
- Hide reset time when remaining is 100% since it's redundant
- Change "Resets In" column to "Resets At" with exact clock times (e.g. "11:17 AM" instead of "3h 53m") - Hide reset time when remaining is 100% since it's redundant
There was a problem hiding this comment.
Pull request overview
Updates quota table output to display reset information as an exact clock time (“Resets At”) instead of a relative duration, and suppresses reset info when the quota is full.
Changes:
- Replace relative “Resets In” formatting with a clock-time “Resets At” display.
- Hide reset time for models whose remaining rounds to 100%.
- Reformat
src/quota/format.tscode style (quotes/semicolons/formatting).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const resetDate = new Date(Date.now() + ms); | ||
| return resetDate.toLocaleTimeString([], { | ||
| hour: "numeric", | ||
| minute: "2-digit", | ||
| }); |
There was a problem hiding this comment.
formatTimeUntilReset computes the reset clock time using Date.now() + ms. Since timeUntilResetMs is already calculated relative to the time the snapshot was built, this will drift if a snapshot is printed later (it will show a reset time that’s too late). Use the snapshot timestamp as the base, or (preferably) format model.resetTime (an absolute time) when available.
| return resetDate.toLocaleTimeString([], { | ||
| hour: "numeric", | ||
| minute: "2-digit", | ||
| }); |
There was a problem hiding this comment.
The "Resets At" value only prints a time-of-day. If the reset crosses a date boundary (e.g., late-night usage) or the quota window is >24h, the output becomes ambiguous/misleading. Consider including the date when resetDate is not on the same day as the snapshot/now (or use a month/day + time format).
| import Table from "cli-table3"; | ||
| import type { QuotaSnapshot, ModelQuotaInfo } from "./types.js"; |
There was a problem hiding this comment.
This file was reformatted to double quotes and semicolons, while the surrounding codebase appears to consistently use single quotes and omit semicolons (e.g., src/google/parser.ts, test/quota/format.test.ts). Consider aligning this file with the established formatting conventions (or apply the repo’s formatter across the project) to avoid inconsistent style.
| head: ["Model", "Remaining", "Resets At"], | ||
| style: { | ||
| head: ['cyan'], | ||
| border: ['gray'] | ||
| } | ||
| }) | ||
| head: ["cyan"], | ||
| border: ["gray"], | ||
| }, | ||
| }); | ||
|
|
||
| for (const model of visibleModels) { | ||
| const isFull = | ||
| model.remainingPercentage !== undefined && | ||
| Math.round(model.remainingPercentage * 100) === 100; | ||
| table.push([ | ||
| model.label, | ||
| formatRemaining(model), | ||
| formatTimeUntilReset(model.timeUntilResetMs) | ||
| ]) | ||
| isFull ? "" : formatTimeUntilReset(model.timeUntilResetMs), | ||
| ]); |
There was a problem hiding this comment.
New behavior is introduced here (renamed column to "Resets At" and hiding the reset time when remaining rounds to 100%), but there’s no test coverage ensuring: (1) the header changed, (2) the reset cell is blank at 100%, and (3) the reset time formatting is stable. Adding assertions in the existing quota formatting tests would prevent regressions.