Cannot filter with timestamps (CreatedAt)
Closed this issue · 3 comments
Describe the Bug.
I want to filter list data based on the createdAt date, it doesn't fetch any results, because in the filter it has date type selection while in the databse its saved as datetime.
Reproduction Steps
In any collection, try to filter with timestamps (createdAt/updatedAt)
Environment Info
Payload: 3.0.0-beta.117
Hey @tpahore,
This is likely because it's trying to find a match for exactly 2024-11-01T12:00:00.000Z (which is highly unlikely that you have a createdAt
at just the right time to match this). You can confirm this by looking at the generated where
clause in your query parameters in your url after the query.
For numeric and date fields, you should be using one of greater_than
, greater_than_equal
, less_than
, or less_than_equal
to get hits in your query. See docs for more info.
@akhrarovsaid thank you for the explaination!
I tried with beforeOperation hook and modified the query. it works now.
This issue has been automatically locked.
Please open a new issue if this issue persists with any additional detail.