Skip to content

Commit

Permalink
Set initial state date on chart to one year ago today
Browse files Browse the repository at this point in the history
  • Loading branch information
sophialittlejohn committed Jan 9, 2025
1 parent 164dc4f commit 9c87de5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion centrifuge-app/src/components/Report/ReportContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,12 @@ export function ReportContextProvider({ children }: { children: React.ReactNode
setStartDate(startDate || new Date().toISOString().slice(0, 10))
setLoanStatus(loan || 'ongoing')
} else {
setStartDate(startDate || new Date(new Date().getFullYear(), 0, 1, 1).toISOString().slice(0, 10))
setStartDate(
startDate ||
new Date(Date.UTC(new Date().getUTCFullYear() - 1, new Date().getUTCMonth(), new Date().getUTCDate()))
.toISOString()
.slice(0, 10)
)
setLoanStatus(loan || 'all')
}
}, [reportParam, setLoanStatus, setStartDate, searchParams])
Expand Down

0 comments on commit 9c87de5

Please sign in to comment.