reddit / devvit

Reddit for Developers
https://developers.reddit.com
BSD 3-Clause "New" or "Revised" License
63 stars 14 forks source link

"GetNewPosts" the option "timeframe: 'week' but it still fetches ALL post and not that submitted in a Week #103

Open devvit-help-bot[bot] opened 2 days ago

devvit-help-bot[bot] commented 2 days ago

Details

"GetNewPosts" the option "timeframe: 'week' but it still fetches ALL post and not that submitted in a Week

Additional info

Discord message: _I experienced the same. Got a timeframe "week" but it fetches all posts. I allready told <@892039441093365801> about it. Seems to be a Problem with ReddtiAPI maybe? This is how i got around:

> const oneWeekAgo = Date.now() - 7 24 60 60 1000; > > YOUR CODE >
> // Filter timeframe before return > const recentPosts = posts.filter(post => { > const postCreatedAt = new Date(post.createdAt).getTime(); > return postCreatedAt >= oneWeekAgo;_

Message author: .robmc

Discord link: https://discord.com/channels/1050224141732687912/1050227353311248404/1295649436034269255