diff --git a/src/core/queries/examHooks.ts b/src/core/queries/examHooks.ts index 075e3ec9..e5761027 100644 --- a/src/core/queries/examHooks.ts +++ b/src/core/queries/examHooks.ts @@ -29,8 +29,12 @@ export const useGetExams = () => { .then(exams => exams .map(mapApiExamToExam) - .sort( - (a, b) => a.examStartsAt!.valueOf() - b.examStartsAt!.valueOf(), + .sort((a, b) => + !a.examStartsAt + ? 1 + : !b.examStartsAt + ? -1 + : a.examStartsAt.valueOf() - b.examStartsAt.valueOf(), ), ), );