From 39567c6c224fb1e5b9d0111461bb0cc78001f888 Mon Sep 17 00:00:00 2001 From: advplyr Date: Tue, 11 Feb 2025 16:47:34 -0600 Subject: [PATCH] Update view feed modal to sort episodes by pub date ascending --- client/pages/config/rss-feeds.vue | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/client/pages/config/rss-feeds.vue b/client/pages/config/rss-feeds.vue index 9b070f91..c3f60859 100644 --- a/client/pages/config/rss-feeds.vue +++ b/client/pages/config/rss-feeds.vue @@ -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()