Skip to content

feat: show exact reset times instead of relative durations#13

Open
03u4nc wants to merge 1 commit into
skainguyen1412:mainfrom
03u4nc:main
Open

feat: show exact reset times instead of relative durations#13
03u4nc wants to merge 1 commit into
skainguyen1412:mainfrom
03u4nc:main

Conversation

@03u4nc

@03u4nc 03u4nc commented Mar 6, 2026

Copy link
Copy Markdown
  • 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
Copilot AI review requested due to automatic review settings March 6, 2026 03:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.ts code style (quotes/semicolons/formatting).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/quota/format.ts
Comment on lines +21 to +25
const resetDate = new Date(Date.now() + ms);
return resetDate.toLocaleTimeString([], {
hour: "numeric",
minute: "2-digit",
});

Copilot AI Mar 6, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment thread src/quota/format.ts
Comment on lines +22 to +25
return resetDate.toLocaleTimeString([], {
hour: "numeric",
minute: "2-digit",
});

Copilot AI Mar 6, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
Comment thread src/quota/format.ts
Comment on lines +5 to +6
import Table from "cli-table3";
import type { QuotaSnapshot, ModelQuotaInfo } from "./types.js";

Copilot AI Mar 6, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment thread src/quota/format.ts
Comment on lines +79 to +94
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),
]);

Copilot AI Mar 6, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants