Merge branch 'client' of gitlab.stud.idi.ntnu.no:felixalb/dcst1008-2022-group1 into client

This commit is contained in:
Kristoffer Juelsenn 2022-04-09 11:06:05 +02:00
commit 155d477007
1 changed files with 7 additions and 2 deletions

View File

@ -110,13 +110,18 @@ function TournamentList() {
return;
}
let today = new Date()
let currenttournaments = []
let tournaments = Object.values(data.data);
for (let i = 0; i < tournaments.length; i++) {
tournaments[i].startTime = new Date(tournaments[i].startTime);
tournaments[i].endTime = new Date(tournaments[i].endTime);
if(today - tournaments[i].endTime <= 24*60*60*1000) {
currenttournaments.push(tournaments[i])
}
}
setTournamentList(tournaments);
// tournaments.filter((tournament) => today - tournament.endTime < 24*60*60*1000)
setTournamentList(currenttournaments);
})
.catch((err) => console.log(err.message));
}, []);