Skip to content

Commit

Permalink
Simplify timeframe loop
Browse files Browse the repository at this point in the history
  • Loading branch information
GODrums committed Oct 1, 2024
1 parent 1d61325 commit 0f71666
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions webapp/src/app/home/leaderboard/filter/filter.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ export class LeaderboardFilterComponent {
label: `${currentDate.format('MMM D')} - ${now.format('MMM D')}`
});
for (let i = 0; i < 4; i++) {
const newDate = currentDate.subtract(7, 'day');
const startDate = currentDate.subtract(7, 'day');
const endDate = currentDate.subtract(1, 'day');
options.push({
id: newDate.unix(),
value: `${newDate.format('YYYY-MM-DD')}.${currentDate.subtract(1, 'day').format('YYYY-MM-DD')}`,
label: `${newDate.format('MMM D')} - ${currentDate.subtract(1, 'day').format('MMM D')}`
id: startDate.unix(),
value: `${startDate.format('YYYY-MM-DD')}.${endDate.format('YYYY-MM-DD')}`,
label: `${startDate.format('MMM D')} - ${endDate.format('MMM D')}`
});
currentDate = newDate;
currentDate = startDate;
}
this.options.set(options);
}
Expand Down

0 comments on commit 0f71666

Please sign in to comment.