mirror of
https://github.com/wekan/wekan.git
synced 2025-12-22 18:30:13 +01:00
use Intl.NumberFormat to format currency
This commit is contained in:
parent
d26786a628
commit
8732e4b18f
7 changed files with 70 additions and 25 deletions
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue