Use the week starting dates

This commit is contained in:
Arnaud 2024-11-27 17:21:36 +01:00
parent 7bb34cee44
commit cef126a063
No known key found for this signature in database
GPG Key ID: 69D6CE281FCAE663

View File

@ -48,9 +48,20 @@ export function WalletCard({ tab }: Props) {
};
if (chart.current) {
const today = new Date();
const startOfWeek = today.getDate() - today.getDay() + 1;
const startDates = [];
today.setDate(startOfWeek);
for (let i = 0; i < 5; i++) {
startDates.push(today.toISOString().split("T")[0]);
today.setDate(today.getDate() + 7);
}
const data = {
daily: ["MON", "TUE", "WED", "THU", "WED", "SAT", "SUN"],
weekly: ["1", "2", "3", "4", "5", "6"],
weekly: startDates,
monthly: ["JAN", "FEB", "MAR", "APR", "MAY", "JUN"],
}[tab];