1
0
mirror of https://github.com/coalaura/whiskr.git synced 2025-09-09 01:09:54 +00:00

statistics

This commit is contained in:
Laura
2025-08-11 15:43:00 +02:00
parent c10b657742
commit 8a790df2af
12 changed files with 347 additions and 11 deletions

View File

@@ -60,3 +60,17 @@ function escapeHtml(text) {
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;");
}
function formatMilliseconds(ms) {
if (ms < 1000) {
return `${ms}ms`;
} else if (ms < 10000) {
return `${(ms / 1000).toFixed(1)}s`;
}
return `${Math.round(ms / 1000)}s`;
}
function fixed(num, decimals = 0) {
return num.toFixed(decimals).replace(/\.?0+$/m, "");
}