feat(dashboard): add last updated at course sort option (#823)
Co-authored-by: Cursor Agent <[email protected]> Co-authored-by: Rotimi Best <[email protected]>
This commit is contained in:
co-authored by
Cursor Agent
Rotimi Best
parent
753f9b3d7b
commit
9b9dccc07a
@@ -39,6 +39,13 @@
|
||||
return coursesFiltered.sort(
|
||||
(a, b) => new Date(a.createdAt ?? '').getTime() - new Date(b.createdAt ?? '').getTime()
|
||||
);
|
||||
} else if (sortKey === CourseSortBy.LastUpdatedAt) {
|
||||
return coursesFiltered.sort((a, b) => {
|
||||
const aUpdatedAt = new Date(a.updatedAt ?? a.createdAt ?? '').getTime();
|
||||
const bUpdatedAt = new Date(b.updatedAt ?? b.createdAt ?? '').getTime();
|
||||
|
||||
return bUpdatedAt - aUpdatedAt;
|
||||
});
|
||||
} else if (sortKey === CourseSortBy.Published) {
|
||||
return coursesFiltered.sort((a, b) => Number(b.isPublished) - Number(a.isPublished));
|
||||
} else if (sortKey === CourseSortBy.Lessons) {
|
||||
|
||||
Reference in New Issue
Block a user