Skip to content
This repository has been archived by the owner on May 11, 2021. It is now read-only.

Commit

Permalink
fix: make sorting correct in short history
Browse files Browse the repository at this point in the history
  • Loading branch information
igorkamyshev committed Jul 24, 2020
1 parent 1cd4902 commit cb57329
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/legacy_features/history/helpers/historyToTableData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,16 @@ export const historyToTableData = (expenses: Expense[], earnings: Earning[]) =>
currency: outcome.currency,
comment: outcome.category,
})),
].map((transaction) => ({
...transaction,
rawAmount: transaction.amount,
amount: formatMoney(transaction.currency, {
withPenny: true,
withSign: true,
})(transaction.amount),
}));
]
.map((transaction) => ({
...transaction,
rawAmount: transaction.amount,
amount: formatMoney(transaction.currency, {
withPenny: true,
withSign: true,
})(transaction.amount),
}))
.sort(
({ date: dateA }, { date: dateB }) =>
(dateB?.valueOf() ?? 0) - (dateA?.valueOf() ?? 0),
);

0 comments on commit cb57329

Please sign in to comment.