Go Pro Sign Up Login
0 days 0 hrs 0 min 0 sec

Summer Sale

50% off Level Up Pro until you unsubscribe.
Get access to ALL 128 courses on Level Up Tutorials

This is your last chance to get Level Up Pro for $145/year.

or Learn More
Moon Moon

Buy Now and unlock this series

$

49

.99

$

34

.99

yours forever

Become a Pro and unlock everything

$

24

.99

per month

GraphQL Sorting Filtering and Limiting

Downloads

Become a pro to download code and videos

Comments

Manav Misra

over 2 years ago [edited]

🤔Well, I too have this same experience. Seems to not work if going more specific than the year. And Gridsome docs not showing any other example with more than 'year.' https://gridsome.org/docs/filtering-data/#date-fields Tommy Williams

Tommy Williams

almost 3 years ago

I am getting very inconsistent results with the date-based query in the playground. I have tried stopping and restarting the gridsome server, reloading the playground, etc.

With no filters, I get this:

{ "data": { "allBlogPost": { "edges": [ { "node": { "title": "What's Up?", "date": "2019-08-28T00:00:00.000Z" } }, { "node": { "title": "A new post", "date": "2019-08-27T00:00:00.000Z" } }, { "node": { "title": "Hello World", "date": "2019-08-26T00:00:00.000Z" } } ] } } }

If I use a filter like this:

allBlogPost (filter: { date: {lt: "2019-01-01" }}) {

I still get the same results back.

If I change the "lt" to a "gt", I get nothing back.

If I change the date to just "2019" then "gt" and "lt" work as expected. But if I use "2020" as the date, I get nothing for "lt" and all results for "gt." Huh? "2018" seems to work as expected.

If I try to further specify dates, say with "2019-08" or "2019-08-01" then lt and gt are again reversed.

I feel like I'm missing something fundamental here but I don't know what it is.

Want to join the conversation?

Become a Pro member today!