mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 05:10:31 +00:00
WIP financial statements.
This commit is contained in:
16
client/src/components/Money.js
Normal file
16
client/src/components/Money.js
Normal file
@@ -0,0 +1,16 @@
|
||||
import React from 'react';
|
||||
import Currency from 'js-money/lib/currency';
|
||||
import accounting from 'accounting';
|
||||
|
||||
function formattedAmount(cents, currency) {
|
||||
const { symbol, decimal_digits: precision } = Currency[currency];
|
||||
const amount = cents / Math.pow(10, precision);
|
||||
|
||||
return accounting.formatMoney(amount, { symbol, precision });
|
||||
}
|
||||
|
||||
export default function Money({ amount, currency }) {
|
||||
return (
|
||||
<span>{ formattedAmount(amount, currency) }</span>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user