Skip to content

Commit

Permalink
fix date sorting
Browse files Browse the repository at this point in the history
fixes Webklex#7
  • Loading branch information
Wikinaut committed Nov 25, 2022
1 parent c49e6a9 commit 1554eaa
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ func (a *Application) LoadTweetCache() {
}
}
sort.Slice(tweets, func(i, j int) bool {
// t1, _ := time.Parse("Mon Jan 02 03:04:05 -0700 2006", tweets[i].Tweet.CreatedAt)
// t2, _ := time.Parse("Mon Jan 02 03:04:05 -0700 2006", tweets[j].Tweet.CreatedAt)
// return t1.Before(t2)
return tweets[i].Index < tweets[j].Index
t1, _ := time.Parse("Mon Jan 02 15:04:05 -0700 2006", tweets[i].Tweet.CreatedAt)
t2, _ := time.Parse("Mon Jan 02 15:04:05 -0700 2006", tweets[j].Tweet.CreatedAt)
return t1.Before(t2)
// return tweets[i].Index < tweets[j].Index
})
a.tweets = tweets
}
Expand Down

0 comments on commit 1554eaa

Please sign in to comment.