diff --git a/modules/feedreader/widget.go b/modules/feedreader/widget.go index 31dbb978..ce92ce9e 100644 --- a/modules/feedreader/widget.go +++ b/modules/feedreader/widget.go @@ -3,7 +3,6 @@ package feedreader import ( "fmt" "sort" - "time" "github.com/mmcdole/gofeed" "github.com/rivo/tview" @@ -11,10 +10,6 @@ import ( "github.com/wtfutil/wtf/view" ) -const ( - publishedDateLayout = "Mon, 02 2006 15:04:05" -) - // FeedItem represents an item returned from an RSS or Atom feed type FeedItem struct { item *gofeed.Item @@ -158,10 +153,7 @@ func (widget *Widget) content() (string, string, bool) { // feedItems are sorted by published date func (widget *Widget) sort(feedItems []*FeedItem) []*FeedItem { sort.Slice(feedItems, func(i, j int) bool { - iTime, _ := time.Parse(publishedDateLayout, feedItems[i].item.Published) - jTime, _ := time.Parse(publishedDateLayout, feedItems[j].item.Published) - - return iTime.After(jTime) + return feedItems[i].item.PublishedParsed.After(*feedItems[j].item.PublishedParsed) }) return feedItems