fix balance display when balance is negative

This commit is contained in:
MaysWind
2020-11-29 14:29:24 +08:00
parent 0e5b6555f3
commit c4e6c2b465
+10
View File
@@ -26,6 +26,12 @@ export default function ({i18n}, value, currencyCode) {
value = value.toString();
}
const negative = value.charAt(0) === '-';
if (negative) {
value = value.substr(1);
}
if (value.length === 0) {
value = '0.00';
} else if (value.length === 1) {
@@ -43,6 +49,10 @@ export default function ({i18n}, value, currencyCode) {
value = `${integer}.${decimals}`;
}
if (negative) {
value = `-${value}`;
}
const currencyDisplayMode = settings.getCurrencyDisplayMode();
if (currencyDisplayMode === 'symbol') {