GraphQL query for future events does not work #42
-
First of all I'm very happy that you introduced the new GraphQL feature! comes at the perfect timing for an upcoming launch. Unfortunatelty I am unable to query for future events only. Steps to reproduce
{
solspace_calendar {
version
calendar {
id
events {
id
startDate
}
}
}
} results in a list of entries: {
"data": {
"solspace_calendar": {
"version": "3.3.0",
"calendar": {
"id": 1,
"events": [
{
"id": 64,
"startDate": "2020-05-03T00:00:00+00:00"
},
{
"id": 64,
"startDate": "2020-06-07T00:00:00+00:00"
},
{
"id": 64,
"startDate": "2020-07-05T00:00:00+00:00"
},
{
"id": 64,
"startDate": "2020-08-02T00:00:00+00:00"
}
]
}
}
}
}
{
solspace_calendar {
version
calendar {
id
events(startsAfter:"now") {
id
startDate
}
}
}
} Result: {
"data": {
"solspace_calendar": {
"version": "3.3.0",
"calendar": {
"id": 1,
"events": []
}
}
}
} I also tested with Expected behavior Extected result would be a list of events starting after today. Craft & Plugin Info (please complete the following information):
Additional context
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Glad to hear @denisyilmaz If you want to query events based on their dates, there are filtering functions available. A small example how to filter in your case: {
solspace_calendar {
events (rangeStart: "now") {
id
title
startDate
}
}
} The |
Beta Was this translation helpful? Give feedback.
Glad to hear @denisyilmaz
If you want to query events based on their dates, there are filtering functions available.
I just noticed that the docs don't have the GQL examples released yet, I'll post them here once they are.
A small example how to filter in your case:
The
startsAfter
filter is for filtering base events, not the occurrences.