mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-16 07:57:33 +08:00
add currency filter
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import settings from "../lib/settings.js";
|
||||
|
||||
export default function ({ i18n }, value, currencyCode) {
|
||||
if (!value) {
|
||||
return value;
|
||||
}
|
||||
|
||||
value = value / 100;
|
||||
const currencyDisplayMode = settings.getCurrencyDisplayMode();
|
||||
|
||||
if (currencyDisplayMode === 'code') {
|
||||
return `${value} ${currencyCode}`;
|
||||
} else if (currencyDisplayMode === 'name') {
|
||||
const name = i18n.t(`currency.${currencyCode}`);
|
||||
return `${value} ${name}`;
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user