Skip to content
Snippets Groups Projects
Commit c5049c28 authored by Lukáš Kratochvíl's avatar Lukáš Kratochvíl
Browse files

fix: BrowseDirectors - birthdate sorting when undefined, added comments

parent 5923b712
No related branches found
No related tags found
No related merge requests found
......@@ -19,7 +19,6 @@ const exampleDirectors: DirectorIO[] = [{
id: "890",
name: "Karel",
surname: "Vomacka",
birthdate: "1.2.1987",
},
{
id: "666",
......@@ -58,15 +57,18 @@ export const BrowseDirectors = () => {
const second = b?.birthdate?.split('.').reverse();
if (first === undefined && second === undefined) { return 0; }
if (first === undefined) { return 1;}
if (second === undefined) { return -1;}
if (first === undefined) { return -1;}
if (second === undefined) { return 1;}
// year
if (first[0] > second[0]) {return 1;}
if (first[0] < second[0]) {return -1;}
// month
if (first[1] > second[1]) {return 1;}
if (first[1] < second[1]) {return -1;}
// day
if (first[2] > second[2]) {return 1;}
if (first[2] < second[2]) {return -1;}
return 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment