filter on specific date without caring about min/sec
See original GitHub issuewhat is a good way to filter on specific date?
I am storing data as full date format with timezone like 2018-08-06T14:21:54+02:00
and I am trying to query for specific day like: 2018-08-06
There are only few functionalities available for Date field and none support something like includes
.
Any suggestion?
ps: I know one solution would be making a function/store procedure in Postgres and then call it in the graphql but that is quite limited.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Filter by date | Algolia
Dates aren't only useful for sorting. You can also leverage them to filter search results on a specific date range. Imagine you have...
Read more >10.3 Dates and times with lubridate - Bookdown
The answer clearly depends on the month in question (e.g., July is longer than June, and both are longer than February) and can...
Read more >SQL Unable to filter for a specific date with Group By
Without access to your data this is slightly speculative, but it looks like you're picking up items which have a later exp_date ....
Read more >Using date_start and date_end with date filters | Looker
When there is no value specified for date_filter , both {% date_start date_filter %} and {% date_end date_filter %} will evaluate to NULL...
Read more >mSpy™ Cell Phone Tracker: Your #1 Monitoring Tool
Keep your children safe both online and in the real world with our mSpy™ parental tracking app. Monitor their GPS location, see who...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Personally I’d stick with the “greaterThanOrEqualTo” / “lessThan” combo - it’s more flexible and more explicit. All my databases use UTC. I’m not comfortable exposing a “like” operator - serious performance/DOS issues there; beginsWith would be better.
You’re right. Currently you’d have to write something like:
I can think of a few approaches:
Expose the existing
like
operator, which would translate{ bar: { like: "2018-08-06%" } }
to a where clause ofbar::text LIKE '2018-08-06%'
. This would be also support queries on year, year-month, year-month-day-hour, etc.Create a new
dateEqualTo
operator, which would translate{ bar: { dateEqualTo: "2018-08-06" } }
to a where clause ofbar::date = '2018-08-06'
. This would likely be more performant, especially with an expression index.@benjie, any thoughts?