feat(MED-105): update analysis results view to be by analysis order

This commit is contained in:
2025-08-14 12:10:12 +03:00
parent d3b393156a
commit 1285b02f9c
11 changed files with 140 additions and 59 deletions

View File

@@ -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();
});
}