mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-18 16:54:25 +08:00
fix balance display when balance is negative
This commit is contained in:
@@ -26,6 +26,12 @@ export default function ({i18n}, value, currencyCode) {
|
|||||||
value = value.toString();
|
value = value.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const negative = value.charAt(0) === '-';
|
||||||
|
|
||||||
|
if (negative) {
|
||||||
|
value = value.substr(1);
|
||||||
|
}
|
||||||
|
|
||||||
if (value.length === 0) {
|
if (value.length === 0) {
|
||||||
value = '0.00';
|
value = '0.00';
|
||||||
} else if (value.length === 1) {
|
} else if (value.length === 1) {
|
||||||
@@ -43,6 +49,10 @@ export default function ({i18n}, value, currencyCode) {
|
|||||||
value = `${integer}.${decimals}`;
|
value = `${integer}.${decimals}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (negative) {
|
||||||
|
value = `-${value}`;
|
||||||
|
}
|
||||||
|
|
||||||
const currencyDisplayMode = settings.getCurrencyDisplayMode();
|
const currencyDisplayMode = settings.getCurrencyDisplayMode();
|
||||||
|
|
||||||
if (currencyDisplayMode === 'symbol') {
|
if (currencyDisplayMode === 'symbol') {
|
||||||
|
|||||||
Reference in New Issue
Block a user