From c426fe006e3eeff15fe3c91e9386f5046af5d4cd Mon Sep 17 00:00:00 2001 From: Michael Geers Date: Mon, 27 Jan 2025 21:48:01 +0100 Subject: [PATCH] UI: money format browser compatibility (#18459) --- assets/js/mixins/formatter.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/assets/js/mixins/formatter.js b/assets/js/mixins/formatter.js index 2bb21bc19..a86ff9cb8 100644 --- a/assets/js/mixins/formatter.js +++ b/assets/js/mixins/formatter.js @@ -264,11 +264,13 @@ export default { }, fmtMoney: function (amout = 0, currency = "EUR", decimals = true, withSymbol = false) { const currencyDisplay = withSymbol ? "narrowSymbol" : "code"; + const digits = decimals ? undefined : 0; const result = new Intl.NumberFormat(this.$i18n?.locale, { style: "currency", currency, currencyDisplay, - maximumFractionDigits: decimals ? undefined : 0, + minimumFractionDigits: digits, + maximumFractionDigits: digits, }).format(amout); return withSymbol ? result : result.replace(currency, "").trim();