From c5c8bd823e5151200096525925f56fa6e3f560e0 Mon Sep 17 00:00:00 2001 From: mr-boneman Date: Thu, 27 Mar 2025 12:40:24 +0100 Subject: [PATCH] apply custom timeFormat to atom feeds --- src/rss.nim | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/rss.nim b/src/rss.nim index d013f2b..08ef60c 100644 --- a/src/rss.nim +++ b/src/rss.nim @@ -50,6 +50,20 @@ proc mixRssFeeds*( case feed.kind of Atom: entries.add parseAtom(fetched) + + entries[^1].items = entries[^1].items.mapIt( + block: + var item = it + if feed.timeFormat.len != 0 and item.pubDate.isSome(): + # if the IDE screams at you here, ignore it + item.pubdate = + some(parse(item.pubDate.get(), feed.timeFormat).format(atomTimeFormat)) + if item.updated.isSome(): + item.updated = + some(parse(item.updated.get(), feed.timeFormat).format(atomTimeFormat)) + + item + ) of RSSv2: entries.add parseRss(fetched)