Added sorting to the posts (order by date, descending)

This commit is contained in:
Joachim Nielandt 2018-03-25 20:36:43 +02:00
parent e22d189e52
commit dc0c1cf440

View File

@ -89,6 +89,9 @@ export class PostsComponent implements OnInit, OnDestroy {
// console.log('we should not display this'); // console.log('we should not display this');
} }
} }
// sort the posts
res.sort((p1, p2) => p2.created_timestamp.getMilliseconds() - p1.created_timestamp.getMilliseconds());
this.filteredPosts = res; this.filteredPosts = res;
} }