From c92ac3d719ce4c52f4ced35128dfee8b9653ebf4 Mon Sep 17 00:00:00 2001 From: Honey Date: Fri, 31 Jul 2026 16:16:03 +0200 Subject: [PATCH] fix(web): cleaner German fan-count format (559.542 instead of "559,5 Tsd.") fmtCount now shows the full grouped number below a million (toLocaleString de-DE) and only compacts millions ("1,2 Mio."). The old "Tsd." form read awkwardly on the artist hero. SW ns-v53. Co-Authored-By: Claude Opus 4.8 --- public/sw.js | 2 +- src/utils.js | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/public/sw.js b/public/sw.js index 1d3257b..90ce20d 100644 --- a/public/sw.js +++ b/public/sw.js @@ -1,4 +1,4 @@ -const CACHE = 'ns-v52'; +const CACHE = 'ns-v53'; const PRECACHE = ['/', 'index.html', 'manifest.json', 'icon.svg']; const SKIP_PATHS = ['/rest/stream', '/rest/download', '/config.js']; // Auth token params stripped from cache keys so artwork survives across sessions/token refreshes. diff --git a/src/utils.js b/src/utils.js index ae1b32b..497ca12 100644 --- a/src/utils.js +++ b/src/utils.js @@ -45,13 +45,12 @@ export function formatDur(s) { return `${m}:${sec.toString().padStart(2,'0')}`; } -// Compact count for fan numbers etc.: 559534 → "559,5 Tsd.", 1200000 → "1,2 Mio." +// Fan/count formatting in German: full grouped number up to a million (559534 → "559.542"), +// then compact millions (1200000 → "1,2 Mio."). export function fmtCount(n) { if (n == null || isNaN(n)) return ''; - const de = x => x.toFixed(1).replace(/\.0$/, '').replace('.', ','); - if (n >= 1e6) return de(n / 1e6) + ' Mio.'; - if (n >= 1e3) return de(n / 1e3) + ' Tsd.'; - return String(n); + if (n >= 1e6) return (n / 1e6).toFixed(1).replace(/\.0$/, '').replace('.', ',') + ' Mio.'; + return Math.round(n).toLocaleString('de-DE'); } export function toast(msg) {