I have list of data and I want to filter them from earliest to lates
The list with data looks like this:
[{id: 73, startTime: 2022-12-13T15:30:57.244Z}, {id: 74, startTime: 2022-12-13T10:00:57.244Z}];
And the output should look like this:
[{id: 74, startTime: 2022-12-13T10:00:57.244Z}, {id: 73, startTime: 2022-12-13T15:30:57.244Z}];
How can I do this? P.S. I am using intl
2
Answers
Lets say we have this list:
you can use
sort()
like this:result:
You could use something like: