Commit cc114ce5 authored by Benjamin Bouvier's avatar Benjamin Bouvier Committed by Nicolas Frandeboeuf
Browse files

Fixes #1110: use the budget date when filtering transactions in in-out-charts

parent 7e6d0bce
Pipeline #419133 passed with stage
in 4 minutes and 34 seconds
......@@ -238,13 +238,13 @@ interface InitialProps {
// `initialCurrency` is either set to ALL_CURRENCIES or the first currency seen
// in transactions, or it is undefined if there were no transactions.
function useInOutExtraProps(props: InitialProps) {
let dateFilter: (transaction: Operation) => boolean;
let dateFilter: (date: Date) => boolean;
if (props.fromDate && props.toDate) {
dateFilter = t => t.date >= (props as any).fromDate && t.date <= (props as any).toDate;
dateFilter = d => d >= (props as any).fromDate && d <= (props as any).toDate;
} else if (props.fromDate) {
dateFilter = t => t.date >= (props as any).fromDate;
dateFilter = d => d >= (props as any).fromDate;
} else if (props.toDate) {
dateFilter = t => t.date <= (props as any).toDate;
dateFilter = d => d <= (props as any).toDate;
} else {
dateFilter = () => true;
}
......@@ -265,7 +265,7 @@ function useInOutExtraProps(props: InitialProps) {
}
const transactions = get
.operationsByAccountId(state, accId)
.filter(t => t.type !== INTERNAL_TRANSFER_TYPE.name && dateFilter(t));
.filter(t => t.type !== INTERNAL_TRANSFER_TYPE.name && dateFilter(t.budgetDate));
const entry = ret.get(currency);
assert(typeof entry !== 'undefined', 'just created');
entry.push(...transactions);
......
......@@ -31,7 +31,7 @@ const Access = (props: { accessId: number }) => {
const toDate = new Date();
toDate.setMonth(toDate.getMonth() + 1);
toDate.setDate(-1);
fromDate.setHours(23, 59, 59, 999);
toDate.setHours(23, 59, 59, 999);
return (
<li className="dashboard-access">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment