diff --git a/packages/desktop-client/src/components/reports/Header.jsx b/packages/desktop-client/src/components/reports/Header.jsx index 6fb0ead91bf..bd4ebe076e9 100644 --- a/packages/desktop-client/src/components/reports/Header.jsx +++ b/packages/desktop-client/src/components/reports/Header.jsx @@ -50,7 +50,13 @@ function boundedRange(earliest, start, end) { return [start, end]; } -export function getLatestRange(offset, addNumber) { +function getLatestRange(offset) { + const end = monthUtils.currentMonth(); + const start = monthUtils.subMonths(end, offset); + return [start, end]; +} + +export function getSpecificRange(offset, addNumber) { const currMonth = monthUtils.currentMonth(); const start = monthUtils.subMonths(currMonth, offset); const end = monthUtils.addMonths( diff --git a/packages/desktop-client/src/components/reports/ReportSidebar.jsx b/packages/desktop-client/src/components/reports/ReportSidebar.jsx index 0cfb4083c53..cb8405da9fd 100644 --- a/packages/desktop-client/src/components/reports/ReportSidebar.jsx +++ b/packages/desktop-client/src/components/reports/ReportSidebar.jsx @@ -14,9 +14,9 @@ import { CategorySelector } from './CategorySelector'; import { validateStart, validateEnd, - getLatestRange, getFullRange, validateRange, + getSpecificRange, } from './Header'; import { ModeButton } from './ModeButton'; import { ReportOptions } from './ReportOptions'; @@ -75,7 +75,7 @@ export function ReportSidebar({ break; default: onChangeDates( - ...getLatestRange( + ...getSpecificRange( ReportOptions.dateRangeMap.get(cond), cond === 'Last month' ? 0 : null, ),