Use browser's locale for currency format

This commit is contained in:
2020-07-09 22:15:25 +02:00
parent 4849a755dc
commit a96cca879d
2 changed files with 9 additions and 4 deletions
+3 -2
View File
@@ -1,10 +1,11 @@
import { helper } from '@ember/component/helper';
export default helper(function fmtFiatCurrency(params) {
const formatter = new Intl.NumberFormat('en-US', {
const lang = navigator.language || navigator.userLanguage;
const formatter = new Intl.NumberFormat(lang, {
style: 'currency',
currency: params[1] || 'EUR',
minimumFractionDigits: 2
currencyDisplay: 'code'
})
return formatter.format(params[0]);
});