Skip to content

Commit

Permalink
fix: use current year as reference for all-time panels
Browse files Browse the repository at this point in the history
  • Loading branch information
simonwep committed May 1, 2024
1 parent 7fccd43 commit 224f6bc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/app/pages/dashboard/all-time/AllTime.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ const cards = computed((): Card[] => {
maximumFractionDigits: 2
});
const lastYear = state.years.at(-2);
const currentYear = state.years.at(-1);
const year = new Date().getFullYear();
const lastYear = state.years.find((v) => v.year === year - 1);
const currentYear = state.years.find((v) => v.year === year);
const lastYearIncome = lastYear?.income ? sum(totals(lastYear.income)) : 0;
const lastYearExpenses = lastYear?.expenses ? sum(totals(lastYear.expenses)) : 0;
Expand Down

0 comments on commit 224f6bc

Please sign in to comment.