From: Tim Düsterhus Date: Fri, 5 May 2023 07:37:18 +0000 (+0200) Subject: Fix WCF.String.formatNumeric() X-Git-Tag: 6.0.0_Alpha_1~156 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=54e315a48fbe644637ebd0314b649cba408a53ba;p=GitHub%2FWoltLab%2FWCF.git Fix WCF.String.formatNumeric() The previously used phrase is no longer available to the JavaScript. It would also be inconsistent. Copy the implementation of StringUtil#fornatNumeric see 3a0d55353fe88c7510d7b973e1436bd430bcff46 Fixes #5471 --- diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index 76539306ae..db26367362 100755 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -1967,15 +1967,13 @@ WCF.String = { * @return string */ formatNumeric: function(number, decimalPlaces) { - number = String(WCF.Number.round(number, decimalPlaces || 2)); - var numberParts = number.split('.'); - - number = this.addThousandsSeparator(numberParts[0]); - if (numberParts.length > 1) number += WCF.Language.get('wcf.global.decimalPoint') + numberParts[1]; - - number = number.replace('-', '\u2212'); - - return number; + var maximumFractionDigits = decimalPlaces || 2; + + return Number(number) + .toLocaleString(document.documentElement.lang, { + maximumFractionDigits, + }) + .replace("-", "\u2212"); }, /**