feat(MED-105): update analysis results view to be by analysis order
This commit is contained in:
@@ -18,3 +18,12 @@ export function toTitleCase(str?: string) {
|
||||
text.charAt(0).toUpperCase() + text.substring(1).toLowerCase(),
|
||||
);
|
||||
}
|
||||
|
||||
export function sortByDate<T>(a: T[] | undefined, key: keyof T): T[] | undefined {
|
||||
return a?.sort((a, b) => {
|
||||
if (!a[key] || !b[key]) {
|
||||
return 0;
|
||||
}
|
||||
return new Date(b[key] as string).getTime() - new Date(a[key] as string).getTime();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user