diff options
author | Haben Amare <haben.amare@outlook.com> | 2020-05-25 22:05:06 +0000 |
---|---|---|
committer | Haben Amare <haben.amare@outlook.com> | 2020-05-25 22:05:06 +0000 |
commit | 8732e4b18f65e88947f3d334fc0bcc42a809c76e (patch) | |
tree | 77855ff4ba613b71e3b9e890332e12f384be01ec /client/components/cards/cardCustomFields.js | |
parent | d26786a62821e50926e71ea57f7b330cd3ed2964 (diff) | |
download | wekan-8732e4b18f65e88947f3d334fc0bcc42a809c76e.tar.gz wekan-8732e4b18f65e88947f3d334fc0bcc42a809c76e.tar.bz2 wekan-8732e4b18f65e88947f3d334fc0bcc42a809c76e.zip |
use `Intl.NumberFormat` to format currency
Diffstat (limited to 'client/components/cards/cardCustomFields.js')
-rw-r--r-- | client/components/cards/cardCustomFields.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/client/components/cards/cardCustomFields.js b/client/components/cards/cardCustomFields.js index 737c5454..45f20762 100644 --- a/client/components/cards/cardCustomFields.js +++ b/client/components/cards/cardCustomFields.js @@ -85,11 +85,16 @@ CardCustomField.register('cardCustomField'); onCreated() { super.onCreated(); - this.currencySymbol = this.data().definition.settings.currencySymbol; + this.currencyCode = this.data().definition.settings.currencyCode; } formattedValue() { - return `${this.currencySymbol}${this.data().value}`; + const locale = TAPi18n.getLanguage(); + + return new Intl.NumberFormat(locale, { + style: 'currency', + currency: this.currencyCode, + }).format(this.data().value); } events() { |