Skip to content

Commit 5c30bb0

Browse files
committed
Improvements for overviews in the future
1 parent 3a428d4 commit 5c30bb0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/overview.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "cpp_utils/assert.hpp"
1616

1717
#include "cpp_utils/hash.hpp"
18+
#include "date.hpp"
1819
#include "overview.hpp"
1920
#include "console.hpp"
2021
#include "data_cache.hpp"
@@ -1148,8 +1149,14 @@ void budget::display_month_overview(budget::month month, budget::year year, budg
11481149
second_contents.emplace_back(std::vector<std::string>{"Tax Rate", budget::to_string(tax_rate) + "%"});
11491150
}
11501151

1152+
const budget::date today = budget::local_day();
11511153
const budget::date month_start(year, month, 1);
1152-
const budget::date month_end = month_start.end_of_month();
1154+
budget::date month_end = month_start.end_of_month();
1155+
1156+
// If we are on the current month, we avoid going into the future
1157+
if (month_start.year() == today.year() && month_start.month() == today.month()) {
1158+
month_end = today;
1159+
}
11531160

11541161
auto net_worth_end = get_net_worth(month_end, writer.cache);
11551162
auto net_worth_month_start = get_net_worth(month_start, writer.cache);

0 commit comments

Comments
 (0)