Last active
February 10, 2018 22:57
-
-
Save IgorKurkov/c6608b7d5c626763e01df0209da8906b to your computer and use it in GitHub Desktop.
Sort array of objects by Date string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Arr.sort((a, b)=> { | |
a = new Date(a.sent).getTime(); | |
b = new Date(b.sent).getTime(); | |
return a > b ? 1 : a < b ? -1 : 0; | |
}) | |
.reverse(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment