diff --git a/components/ui/molecules/MonthLoanTable.tsx b/components/ui/molecules/MonthLoanTable.tsx index 55af304..f975ca2 100644 --- a/components/ui/molecules/MonthLoanTable.tsx +++ b/components/ui/molecules/MonthLoanTable.tsx @@ -14,6 +14,7 @@ import { ChevronLeft, ChevronRight, } from 'react-bootstrap-icons' +import { percentFormatter } from '../../../utils/percentFormatter' interface MonthLoanTableProps { results: Results @@ -134,7 +135,7 @@ export const MonthLoanTable: NextPage = ({ )} - {projection.interestRate * 100}% + {percentFormatter.format(projection.interestRate)} {currencyFormatterNoFraction.format(projection.threshold)} diff --git a/utils/percentFormatter.ts b/utils/percentFormatter.ts new file mode 100644 index 0000000..2bdab0d --- /dev/null +++ b/utils/percentFormatter.ts @@ -0,0 +1,5 @@ +export const percentFormatter = new Intl.NumberFormat('en-GB', { + style: 'percent', + minimumFractionDigits: 0, + maximumFractionDigits: 2, +})