Skip to content

Commit

Permalink
fix: keep same timeframe on refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
GODrums committed Oct 3, 2024
1 parent c4b9271 commit 7fd260b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions webapp/src/app/home/leaderboard/filter/filter.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ function formatLabel(startDate: dayjs.Dayjs, endDate: dayjs.Dayjs | undefined) {
})
export class LeaderboardFilterComponent {
protected ListFilter = ListFilter;
after = input<string>();
before = input<string>();
after = input<string>('');
before = input<string>('');

value = signal<string>(`${this.after() ?? dayjs().day(1).format('YYYY-MM-DD')}.${this.before() ?? dayjs().format('YYYY-MM-DD')}`);
value = signal<string>(`${this.after()}.${this.before()}`);

placeholder = computed(() => {
return formatLabel(dayjs(this.after()) ?? dayjs().day(1), this.before() === undefined ? undefined : dayjs(this.before()));
Expand Down Expand Up @@ -74,6 +74,7 @@ export class LeaderboardFilterComponent {

constructor(private router: Router) {
effect(() => {
if (this.value().length === 1) return;
const dates = this.value().split('.');
// change query params
this.router.navigate([], {
Expand Down

0 comments on commit 7fd260b

Please sign in to comment.