@designcrowd/fe-shared-lib 1.2.17-ml-currency-2 → 1.2.17-ml-currency-3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Dockerfile
CHANGED
|
@@ -29,7 +29,7 @@ COPY .npmignore ./
|
|
|
29
29
|
RUN npm run bundle-translation
|
|
30
30
|
|
|
31
31
|
RUN mkdir artifacts
|
|
32
|
-
RUN npm publish --otp=
|
|
32
|
+
RUN npm publish --otp=810416 || (touch artifacts/npm_publish_failed && exit 1)
|
|
33
33
|
RUN cp package.json artifacts/
|
|
34
34
|
|
|
35
35
|
ENTRYPOINT ["/bin/echo", "Nothing to do."]
|
package/package.json
CHANGED
|
@@ -102,7 +102,7 @@ export default {
|
|
|
102
102
|
return parsedAmount.toFixed(this.fraction);
|
|
103
103
|
},
|
|
104
104
|
currencyAbbreviation() {
|
|
105
|
-
return this.showAbbreviation && this.amount && !this.locale
|
|
105
|
+
return this.showAbbreviation && this.amount && !this.locale ? this.currency?.abbreviation?.trim() : '';
|
|
106
106
|
},
|
|
107
107
|
currencySymbol() {
|
|
108
108
|
if (!this.amount || this.amount === 0 || this.locale) {
|
|
@@ -78,7 +78,7 @@ const formatCurrency = (amount, locale, currency, fraction = 0, showAbbreviation
|
|
|
78
78
|
});
|
|
79
79
|
|
|
80
80
|
// i18next always uses iso code for ZAR, prefer symbol over iso code
|
|
81
|
-
if (localeAmount.includes(currency.iso4127Code)) {
|
|
81
|
+
if (localeAmount.includes(currency.iso4127Code) && currency.iso4127Code === 'ZAR') {
|
|
82
82
|
return localeAmount.replace(currency.iso4127Code, currency.symbol);
|
|
83
83
|
}
|
|
84
84
|
|
|
@@ -88,16 +88,23 @@ const formatCurrency = (amount, locale, currency, fraction = 0, showAbbreviation
|
|
|
88
88
|
return localeAmount;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
const abbreviationTrimmed = currency.abbreviation.trim();
|
|
92
|
+
const symbolTrimmed = currency.symbol.trim();
|
|
93
|
+
|
|
94
|
+
// AUD edge case for en-US
|
|
92
95
|
if (currency.iso4127Code === 'AUD') {
|
|
93
|
-
localeAmount = localeAmount.replace('A$',
|
|
96
|
+
localeAmount = localeAmount.replace('A$', symbolTrimmed);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// edge case for pt-PT
|
|
100
|
+
if (localeAmount.includes(currency.iso4127Code)) {
|
|
101
|
+
localeAmount = localeAmount.replace(currency.iso4127Code,`${abbreviationTrimmed}${symbolTrimmed}`);
|
|
94
102
|
}
|
|
95
103
|
|
|
96
|
-
if (showAbbreviation && !localeAmount.includes(
|
|
97
|
-
return
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
return localeAmount.replace(currency.abbreviation, '');
|
|
104
|
+
if (showAbbreviation && !localeAmount.includes(abbreviationTrimmed)) {
|
|
105
|
+
return localeAmount.replace(symbolTrimmed,`${abbreviationTrimmed}${symbolTrimmed}`);
|
|
106
|
+
} else if (!showAbbreviation && localeAmount.includes(abbreviationTrimmed)) {
|
|
107
|
+
return localeAmount.replace(abbreviationTrimmed, '');
|
|
101
108
|
}
|
|
102
109
|
|
|
103
110
|
return localeAmount;
|