mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-25 17:41:14 +00:00
refactor(time): trust pretty-ms defaults
This commit is contained in:
@@ -346,8 +346,6 @@ function formatDuration(value: number | undefined): string {
|
||||
return "n/a";
|
||||
}
|
||||
return prettyMilliseconds(Math.max(0, Math.round(value / 1000) * 1000), {
|
||||
millisecondsDecimalDigits: 0,
|
||||
secondsDecimalDigits: 0,
|
||||
unitCount: 2,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -108,7 +108,6 @@ function formatDuration(ms: number): string {
|
||||
return prettyMilliseconds(Math.max(0, roundedMs), {
|
||||
compact: true,
|
||||
hideYear: true,
|
||||
secondsDecimalDigits: 0,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -243,8 +243,6 @@ function formatDuration(ms: number) {
|
||||
}
|
||||
const roundedMs = ms < 1000 ? Math.round(ms) : Math.round(ms / 1000) * 1000;
|
||||
return prettyMilliseconds(roundedMs, {
|
||||
millisecondsDecimalDigits: 0,
|
||||
secondsDecimalDigits: 0,
|
||||
unitCount: 2,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -24,8 +24,6 @@ export function formatIso(iso?: string) {
|
||||
export function formatDuration(ms: number): string {
|
||||
const roundedMs = ms < 1000 ? Math.round(ms) : Math.round(ms / 1000) * 1000;
|
||||
return prettyMilliseconds(Math.max(0, roundedMs), {
|
||||
millisecondsDecimalDigits: 0,
|
||||
secondsDecimalDigits: 0,
|
||||
unitCount: 2,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -193,8 +193,6 @@ function shouldWriteMatrixQaProgress() {
|
||||
function formatMatrixQaDurationMs(durationMs: number) {
|
||||
const roundedMs = durationMs < 1000 ? Math.round(durationMs) : Math.round(durationMs / 100) * 100;
|
||||
return prettyMilliseconds(Math.max(0, roundedMs), {
|
||||
millisecondsDecimalDigits: 0,
|
||||
secondsDecimalDigits: 1,
|
||||
unitCount: 1,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -65,8 +65,6 @@ export function formatDuration(durationMs: number): string {
|
||||
const roundedMs =
|
||||
durationMs < 1000 ? Math.round(durationMs) : Math.round(durationMs / 1000) * 1000;
|
||||
return prettyMilliseconds(roundedMs, {
|
||||
millisecondsDecimalDigits: 0,
|
||||
secondsDecimalDigits: 0,
|
||||
unitCount: 2,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -594,7 +594,6 @@ export function formatBuildAllDuration(durationMs) {
|
||||
? Math.round(clampedMs / 10) * 10
|
||||
: Math.round(clampedMs / 100) * 100;
|
||||
return prettyMilliseconds(roundedMs, {
|
||||
millisecondsDecimalDigits: 0,
|
||||
secondsDecimalDigits: clampedMs < 10_000 ? 2 : 1,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -449,8 +449,6 @@ function formatDuration(ms) {
|
||||
}
|
||||
const roundedMs = ms < 1000 ? Math.round(ms) : Math.round(ms / 100) * 100;
|
||||
return prettyMilliseconds(Math.max(0, roundedMs), {
|
||||
millisecondsDecimalDigits: 0,
|
||||
secondsDecimalDigits: 1,
|
||||
unitCount: 1,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ export function formatDurationPrecise(
|
||||
}
|
||||
const roundedMs = Math.max(0, Math.round(ms));
|
||||
if (roundedMs < 1000) {
|
||||
return prettyMilliseconds(roundedMs, { millisecondsDecimalDigits: 0 });
|
||||
return prettyMilliseconds(roundedMs);
|
||||
}
|
||||
return formatDurationSeconds(ms, {
|
||||
decimals: options.decimals ?? 2,
|
||||
@@ -61,11 +61,10 @@ export function formatDurationCompact(
|
||||
}
|
||||
const roundedMs = Math.round(ms);
|
||||
if (roundedMs < 1000) {
|
||||
return prettyMilliseconds(roundedMs, { millisecondsDecimalDigits: 0 });
|
||||
return prettyMilliseconds(roundedMs);
|
||||
}
|
||||
const formatted = prettyMilliseconds(Math.round(ms / 1000) * 1000, {
|
||||
hideYear: true,
|
||||
secondsDecimalDigits: 0,
|
||||
unitCount: 2,
|
||||
});
|
||||
return options?.spaced ? formatted : formatted.replaceAll(" ", "");
|
||||
|
||||
Reference in New Issue
Block a user