How to sort timestamp column in the format: "dd/mm/yyyy hh:mm:ss PM/AM" in a react virtualized table as per date sort? currently it is sorting it as a string. Any ideas? Tx.
Asked
Active
Viewed 284 times
1 Answers
0
I found the answer. one must keep the 'dataKey' value to epoch time, and then use cellDataGetter() method to convert the cell data to timestamp like this:
cellDataGetter={({ rowData }) => {
const timestamp = new Date(parseInt(rowData.epochTimeVal, 10) * 1000).toLocaleString();
return (timestamp);
}}

Kombo
- 274
- 1
- 5
- 16