Reputation: 711
I have dates made & formatted by momentjs e.g. ("Sat, Feb 22, 2020 12:55 PM") I read them in from firestore, they appear to come in fine as I sort them first to be sorted descending.
forms.sort(function(left, right) {
return moment.utc(left.timeIn).diff(moment.utc(right.timeIn));
});
Then I do a console.log to check there are all there and sorted correctly.
Next, I pass them into the Record Table component which contains a mui-datatable. At this point, problems start to happen.
{
forms.length > 0 ? (
<RecordTable forms={forms} />
) : (
<div>
<h2>No Records</h2>
</div>
)
}
they do not display on screen sorted descending with most recent date at the top.
{
name: "timeIn",
label: "Time In",
options: {
sortDirection: "desc",
searchable: false
}
},
I am really not sure what I am doing wrong here, as the dates are sorted before they are passed to mui-datatables, and from console logs in the parent component, only 75 records are printed out as oppose to hundreds in mui-data table console.logs
Upvotes: 0
Views: 1997