Skip to content

Commit

Permalink
sort by recent 4 games route
Browse files Browse the repository at this point in the history
  • Loading branch information
dromzeh committed May 29, 2024
1 parent a4561b7 commit 945a32d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/routes/games/getGames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ export const getGames = async (
});

const games = await Promise.all(rootLocations);
games.sort((a, b) => {
const dateA = new Date(a.lastUploaded);
const dateB = new Date(b.lastUploaded);
return dateB.getTime() - dateA.getTime();
});

response = new Response(
JSON.stringify({
Expand Down

0 comments on commit 945a32d

Please sign in to comment.