From d58a2605073c054d07fd553b1f3d0a3fc4bbb859 Mon Sep 17 00:00:00 2001 From: c84c <616846+c84c@users.noreply.github.com> Date: Sun, 22 Jan 2023 01:36:28 +0100 Subject: [PATCH] fix: localized number format Fix #142 --- net_speed.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net_speed.js b/net_speed.js index 83162ca..54f5ee4 100644 --- a/net_speed.js +++ b/net_speed.js @@ -124,8 +124,9 @@ var NetSpeed = class NetSpeed { m_digits -= 2; else if (amount >= 10) m_digits -= 1; + return { - text: amount.toFixed(m_digits - 1), + text: amount.toLocaleString(undefined, { minimumFractionDigits: 0, maximumFractionDigits: m_digits - 1 }), unit: (this.use_bytes ? byte_speed_map : bit_speed_map)[unit] }; }