13 lines
338 B
TypeScript
13 lines
338 B
TypeScript
|
|
import { MoneyDTO } from "@erp/core";
|
||
|
|
import { MoneyValue } from "@repo/rdx-ddd";
|
||
|
|
|
||
|
|
export function formatMoneyDTO(amount: MoneyDTO, locale: string) {
|
||
|
|
const money = MoneyValue.create({
|
||
|
|
value: Number(amount.value),
|
||
|
|
currency_code: amount.currency_code,
|
||
|
|
scale: Number(amount.scale),
|
||
|
|
}).data;
|
||
|
|
|
||
|
|
return money.format(locale);
|
||
|
|
}
|