Skip to content

Commit

Permalink
chore: sort relations upon retrieval
Browse files Browse the repository at this point in the history
  • Loading branch information
katharinawuensche committed Sep 30, 2024
1 parent 8331bc1 commit bfcdb41
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/group-relations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,11 @@ export async function loadAndGroupRelations(endpoint: EndpointType, params: endp
});
}

Object.keys(groupedResults).forEach((key) =>
groupedResults[key]?.sort(
(a, b) => new Date(a.start_date ?? 0).getTime() - new Date(b.start_date ?? 0).getTime(),
),
);

return groupedResults;
}

0 comments on commit bfcdb41

Please sign in to comment.