-
-
Notifications
You must be signed in to change notification settings - Fork 132
Open
Labels
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
Trying to retrieve items from a date range using when, to, from
only works if sort is equal to "top" or "user".
You can see this starting on line 394 in api/resolvers/item.js. whenClause
/whenRange
are only added to the query if sort is 'user' or 'top'
Screenshots
No response
Steps To Reproduce
This is the query I ran:
query GetItems($sort: String, $when: String, $from: String, $to: String, $limit: Limit) {
items(sort: $sort, when: $when, from: $from, to: $to, limit: $limit) {
items {
id
createdAt
title
text
user {
id
name
}
parentId
sats
upvotes
ncomments
subName
}
}
}
with variables:
{'sort': '', 'when': 'custom', 'from': '1751353200000', 'to': '1754031599999', 'limit': 100}
You will retrieve items outside the date range (which in this case is 2025-07-01 to 2025-07-31).
But if you do 'sort': 'top'
, you'll get items in the correct date range
Expected behavior
Date filter should not depend on sort type
Logs
No response
Device information
No response
Additional context
No response