UI: money format browser compatibility (#18459)

This commit is contained in:
Michael Geers 2025-01-27 21:48:01 +01:00 • committed by GitHub
parent e59aead868
commit c426fe006e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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();