Skip to content

A local-first personal finance app

[Bug]: Net worth graph doesn't show current week (#6042)

Jayant Jeet Tomard1fa9b2210da
diff --git a/packages/desktop-client/src/components/reports/reportRanges.ts b/packages/desktop-client/src/components/reports/reportRanges.ts
index 45f172c095..27d5be0710 100644
--- a/packages/desktop-client/src/components/reports/reportRanges.ts
+++ b/packages/desktop-client/src/components/reports/reportRanges.ts
@@ -107,14 +107,16 @@ function boundedRange(
start: string,
end: string,
interval?: string,
- firstDayOfWeekIdx?: SyncedPrefs['firstDayOfWeekIdx'],
+ _firstDayOfWeekIdx?: SyncedPrefs['firstDayOfWeekIdx'],
): [string, string, 'static'] {
switch (interval) {
case 'Daily':
latest = monthUtils.currentDay();
break;
case 'Weekly':
- latest = monthUtils.currentWeek(firstDayOfWeekIdx);
+ // For weekly views, clamp to today so the current (ongoing) week is included
+ // and reflects data up to the current day.
+ latest = monthUtils.currentDay();
break;
case 'Monthly':
latest = monthUtils.getMonthEnd(monthUtils.currentDay());
diff --git a/packages/desktop-client/src/components/reports/spreadsheets/net-worth-spreadsheet.ts b/packages/desktop-client/src/components/reports/spreadsheets/net-worth-spreadsheet.ts
index fb32235fb2..c1236a5771 100644
--- a/packages/desktop-client/src/components/reports/spreadsheets/net-worth-spreadsheet.ts
+++ b/packages/desktop-client/src/components/reports/spreadsheets/net-worth-spreadsheet.ts
@@ -52,9 +52,12 @@ export function createSpreadsheet(
endDate = today;
}
} else if (interval === 'Weekly') {
- const currentWeekStart = monthUtils.currentWeek(firstDayOfWeekIdx);
- if (monthUtils.isAfter(endDate, currentWeekStart)) {
- endDate = currentWeekStart;
+ // Include the ongoing (current) week up to today instead of clamping to the
+ // start of the current week. This ensures the current week appears in the
+ // report even if the week hasn't finished yet.
+ const today = monthUtils.currentDay();
+ if (monthUtils.isAfter(endDate, today)) {
+ endDate = today;
}
}
diff --git a/upcoming-release-notes/6042.md b/upcoming-release-notes/6042.md
new file mode 100644
index 0000000000..dc3b3a77b2
--- /dev/null
+++ b/upcoming-release-notes/6042.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [Jayant-Jeet]
+---
+
+Include the current week in Net Worth report when viewing by Weekly interval.