fix(mysql): preserve fractional dashboard rates

This commit is contained in:
LRcoding authored and GitHub committed 2026-07-15 19:34:26 +08:00
1 parent b9ac69f79a
commit 1a8c1b19a0
3 files changed
+39 -6

No files matched your search

@@ -110,6 +110,13 @@ export function formatNumber(value: number): string {
return Math.round(value).toLocaleString("en-US");
}
const RATE_NUMBER_FORMATTER = new Intl.NumberFormat("en-US", { maximumFractionDigits: 3 });
/** Cumulative-counter rates can be below 1/s, so preserve their fractional value. */
export function formatRate(value: number): string {
return Number.isFinite(value) ? RATE_NUMBER_FORMATTER.format(value) : "0";
}
const BYTE_UNITS = ["B", "KB", "MB", "GB", "TB"];
export function formatBytes(value: number): string {