I have a list which I want sort according to Arrival Date & Departure Date based on Caption and Value. But Arrival and Departure don't exist together in the list. If sort using arrival, then the departure can be ignored, just push to the bottom of the list, and vice versa. How can I achieve that?
var svehicleList = [
{
Brand: 'Volvo',
Summary: [
{
Caption: "Consignee",
Value: "ONE TO ONE SDN BHD",
},
{
Caption: "Arrival",
Value: "18-08-2020 06:01",
}
]
},
{
Brand: 'BMW',
Summary: [
{
Caption: "Consignee",
Value: "ABC SDN BHD",
},
{
Caption: "Arrival",
Value: "14-08-2020 16:03",
}
]
},
{
Brand: 'TOYOTA',
Summary: [
{
Caption: "Consignee",
Value: "MATTA SDN BHD",
},
{
Caption: "Departure",
Value: "14-08-2020 16:03",
}
]
},
{
Brand: 'FERRARI',
Summary: [
{
Caption: "Consignee",
Value: "GLOBAL P SDN BHD",
},
{
Caption: "Departure",
Value: "14-08-2020 18:03",
}
]
},
{
Brand: 'HONDA',
Summary: [
{
Caption: "Consignee",
Value: "HH SDN BHD",
},
{
Caption: "Arrival",
Value: "09-09-2020 16:03",
}
]
},
];
Edited: There is actually two object in summary.