Date Sorting
Hello, I am using the 'react table' and 'moment' to format dates in the column I am trying to sort. However, although I have set the accessor like so: { Header: 'Date', id: 'date', accessor: row => moment(row.start).format('lll'), }, The column is still sorting as a literal string. I have been looking through the many solutions suggested on this repo, but none have seemed to work for me. I welcome any suggestions to sorting date. Many thanks in advance!
Please repost this question in the https://spectrum.chat/react-table forum. Thanks!
@mBromige did you receive any useful answer?
This is mrBromige anwser on spectrum:
I have found a solution, if experiencing the same issues:
4:06pm
{ Header: 'Date', id: 'date', accessor: row => moment(row.start).format('x'), Cell: row => moment(row.original.start).format('lll'), } 4:07pm Sort the accessor by timestamp and then format it to your desired moment date style