Skip to content

Commit

Permalink
Use the week starting dates
Browse files Browse the repository at this point in the history
  • Loading branch information
2-towns committed Nov 27, 2024
1 parent 7bb34ce commit cef126a
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/components/ConnectedAccount/WalletCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand Down

0 comments on commit cef126a

Please sign in to comment.