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

Open
#103 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
typescript
Domain
api

Research direction

Start at the GetNewPosts entry point and trace how the timeframe option is applied when fetching posts. Reproduce the issue with timeframe set to "week" and compare the returned posts' creation dates. Done means the result contains only posts submitted within the requested week, with a regression test if the existing test structure supports it.

Written by the indexing model from the issue text.

Description

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

Dominant language
TypeScript
Stars
210
Forks
88
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from reddit/devvit

All issues in reddit/devvit

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.