Skip to content

Instantly share code, notes, and snippets.

@wholypantalones
Created April 18, 2019 14:45
Show Gist options
  • Save wholypantalones/0b67662ecead5fd1ae341da6be42c902 to your computer and use it in GitHub Desktop.
Save wholypantalones/0b67662ecead5fd1ae341da6be42c902 to your computer and use it in GitHub Desktop.
Typescript sort array by earliest date
sortByEarliestDate(arr) {
return arr.sort((a: number, b: number) => {
return +new Date(a['sort']) - +new Date(b['sort']);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment