fix(web,cli): carry duration and byte abbreviations into the next unit (#112)

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
GaoYuYang
2026-07-29 16:40:13 +08:00
committed by GitHub
parent e0a47254af
commit cd1630ae8f
6 changed files with 75 additions and 8 deletions
+4 -2
View File
@@ -134,8 +134,10 @@ function humanizeDuration(ms: number): string {
if (ms < 1000) return `${Math.round(ms)}ms`;
const s = ms / 1000;
if (s < 60) return `${trimZero(s)}s`;
const m = Math.floor(s / 60);
return `${m}m${Math.round(s % 60)}s`;
// The minute form rounds the total before splitting it: rounding the remainder while
// flooring the minutes lets 119.7s print as `1m60s` instead of `2m0s`.
const whole = Math.round(s);
return `${Math.floor(whole / 60)}m${whole % 60}s`;
}
export function formatAbort(p: AbortPayload, t: Messages): string {