From fa5045ed6f410b873a9a9467bbd11624cb85678e Mon Sep 17 00:00:00 2001 From: alexanderb Date: Wed, 16 Feb 2022 11:44:21 +0100 Subject: [PATCH] fix: android currency formatting --- src/nativescript-intl.android.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/nativescript-intl.android.ts b/src/nativescript-intl.android.ts index 73f7942..3546b5f 100644 --- a/src/nativescript-intl.android.ts +++ b/src/nativescript-intl.android.ts @@ -160,6 +160,11 @@ export class NumberFormat extends commonNumberFormat { let decimalFormatSymbols = locale ? new java.text.DecimalFormatSymbols(getNativeLocale(locale)) : new java.text.DecimalFormatSymbols(); + + if (options && options.currency !== void 0) { + decimalFormatSymbols.setCurrency(java.util.Currency.getInstance(options.currency)); + } + numberFormat.setDecimalFormatSymbols(decimalFormatSymbols); if (options && (options.style.toLowerCase() === "currency" && options.currencyDisplay === "code")) { @@ -170,10 +175,6 @@ export class NumberFormat extends commonNumberFormat { numberFormat = new java.text.DecimalFormat(currrentPattern); numberFormat.setDecimalFormatSymbols(decimalFormatSymbols); } - - if (options.currency !== void 0) { - decimalFormatSymbols.setCurrency(java.util.Currency.getInstance(options.currency)); - } } return numberFormat.format(value);