Fixed sort
This commit is contained in:
@@ -25,7 +25,6 @@ function showFeeds() {
|
||||
|
||||
function tweetCell(tweet) {
|
||||
const date = new Date(tweet.created_at);
|
||||
console.log(new Intl.DateTimeFormat('en-GB').format(date));
|
||||
var cell = document.createElement("div");
|
||||
cell.innerHTML =
|
||||
`<div class="tweet">
|
||||
@@ -98,7 +97,6 @@ function searchForWords(searchWords, tweets){
|
||||
}
|
||||
|
||||
function sortTweets(tweets, sort){
|
||||
console.log(sort)
|
||||
if(typeof sort.sortby == 'undefined'){
|
||||
return tweets
|
||||
}
|
||||
@@ -129,10 +127,8 @@ function sortTweets(tweets, sort){
|
||||
}
|
||||
if (sort.sortby == "time"){
|
||||
if(sort.order == 'asc'){
|
||||
console.log("asc")
|
||||
tweets.sort(function(a,b){return Date(b.created_at)-Date(a.reply_count)})
|
||||
} else{
|
||||
console.log("desc")
|
||||
tweets.sort(function(a,b){return Date(a.created_at)-Date(b.reply_count)})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user