don't display posts made in the future
Jes Olson j3s@c3f.net
Fri, 21 Feb 2025 19:54:24 -0500
2 files changed,
15 insertions(+),
1 deletions(-)
M
reaper/reaper.go
→
reaper/reaper.go
@@ -166,6 +166,20 @@ })
return posts } +func (r *Reaper) TrimFuturePosts(items []*rss.Item) []*rss.Item { + var posts []*rss.Item + now := time.Now() + + for _, i := range items { + if !i.Date.After(now) { + // Only include posts that are not in the future + posts = append(posts, i) + } + } + + return posts +} + // Fetch attempts to fetch a feed from a given url, marshal // it into a feed object, and manage it via reaper. func (r *Reaper) Fetch(url string) error {