ElasticGraph Query API: DateTime Filtering
ElasticGraph supports three different date/time types:
Date
- A date, represented as an ISO 8601 date string.
Example:
"2024-10-15"
. DateTime
- A timestamp, represented as an ISO 8601 time string.
Example:
"2024-10-15T07:23:15Z"
. LocalTime
- A local time such as
"23:59:33"
or"07:20:47.454"
without a time zone or offset, formatted based on the partial-time portion of RFC3339.
All three support the standard set of equality and
comparison predicates. In addition, DateTime
fields
support one more filtering operator:
timeOfDay
- Matches records based on the time-of-day of the DateTime values.
When
null
or an empty object is passed, matches no documents.
For example, you could use it to find shows that started between noon and 3 pm on any date:
query FindEarlyAfternoonShows {
artists(filter: {
tours: {anySatisfy: {shows: {anySatisfy: {
startedAt: {
timeOfDay: {
timeZone: "America/Los_Angeles"
gte: "12:00:00"
lt: "15:00:00"
}
}
}}}}
}) {
nodes {
name
tours {
shows {
venue {
id
}
startedAt
}
}
}
}
}