Skip to content

or conditions in graph ql queries #12042

Answered by brianjhanson
mihob asked this question in Q&A
Discussion options

You must be logged in to vote

As long as your start & end date fields are date fields, you can query them using the date fields syntax.

In GraphQL the following would get all event entries with both a start & end date in the future

query {
  entries(section:"events", startDate:"> now", "endDate": "> now") {
    title
  }
}

If you need to get more complex, this will get all events with a start date from now until December 1, 2022

query {
  entries(section:"events", startDate:["and", "> now", "< 2022-12-01"]) {
    title
  }
}

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@mihob
Comment options

@brianjhanson
Comment options

@mihob
Comment options

@brianjhanson
Comment options

Answer selected by mihob
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants