Update view feed modal to sort episodes by pub date ascending

This commit is contained in:
advplyr 2025-02-11 16:47:34 -06:00
parent ed3af5bdcd
commit 39567c6c22

View File

@ -137,7 +137,16 @@ export default {
this.$toast.error(this.$strings.ToastFailedToLoadData)
return
}
this.feeds = data.feeds
this.feeds = data.feeds.map((feed) => ({
...feed,
episodes: [...feed.episodes].sort((a, b) => {
if (!a.pubDate) return 1 // null dates sort to end
if (!b.pubDate) return -1
const dateA = new Date(a.pubDate)
const dateB = new Date(b.pubDate)
return dateA - dateB
})
}))
},
init() {
this.loadFeeds()