I have an array for a timeline chart
of Google Charts
So the array looks like follows
let data = [
['Outreach ICU Follow-up', '2021-01-25', 2021-02-01],
['Hospital Stay' , '2021-01-01', '2021-03-01'],
['ICU Stay' , '2021-01-02', '2021-01-25'],
['Outreach ICU Follow-up', '2021-02-20', '2021-03-01'],
['ICU Stay' , '2021-02-01', '2021-02-20'],
]
I lined up the date to see the chronological order. I need to sort this by the first data ( element 1
)
Cant use this because its for objects I think.
let ass = data.sort((x,y)=>y.dlk_assess_order-x.dlk_assess_order);
And this one is futile as-well.
var data = data.sort(function(a, b) { return a - b; });
How does one sort and array like this please?
Is there perhaps a lodash
function?