Skip to content

Commit

Permalink
fix(ui): Fixed amount formatting for transactions view.
Browse files Browse the repository at this point in the history
The transactions view was not using the intl formatter that was being
used elsewhere in the UI. It has not been updated such that it will use
the intl formatter.

Related To #1169
  • Loading branch information
elliotcourant committed Dec 21, 2022
1 parent aa78afa commit 5702a3b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import TransactionItemMobile from 'components/Transactions/TransactionsView/TransactionItem.mobile';
import useIsMobile from 'hooks/useIsMobile';
import React, { Fragment } from 'react';
import { AccessTime, Work } from '@mui/icons-material';
import { Avatar, Chip, Divider, ListItem, ListItemAvatar, ListItemText, useMediaQuery } from '@mui/material';
import { AccessTime } from '@mui/icons-material';
import { Chip, Divider, ListItem } from '@mui/material';
import classnames from 'classnames';

import TransactionIcon from 'components/Transactions/components/TransactionIcon';
Expand Down
6 changes: 4 additions & 2 deletions ui/models/Transaction.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import moment from 'moment';

import formatAmount from 'util/formatAmount';
import { mustParseToMoment, parseToMomentMaybe } from 'util/parseToMoment';

export default class Transaction {
Expand Down Expand Up @@ -31,11 +32,12 @@ export default class Transaction {
}

getAmountString(): string {
const amount = Math.abs(this.amount);
if (this.amount < 0) {
return `+ $${ (-this.amount / 100).toFixed(2) }`;
return `+ ${ formatAmount(amount) }`;
}

return `$${ (this.amount / 100).toFixed(2) }`;
return formatAmount(amount);
}

getIsAddition(): boolean {
Expand Down

0 comments on commit 5702a3b

Please sign in to comment.