Closed mvdesign closed 4 years ago
Could you have a look at which version of MySQL you are running? The query behavior needs MySQL 5.7 and will not work on lower versions (as stated in the readme).
It looks like that is likely the culprit. I did see that note in the readme and tried to check the version, but I must have been looking in the wrong place. It appears that this server is running a previous version. I'm going to see if I can get an upgrade. Hopefully that will sort itself out. If not, I'll see if I can come back with a more specific set of questions.
Thanks for your help and have a wonderful weekend!
Hmmmm... on further investigation with hosting support, it looks like our host uses MariaDB 10.2.26. And it appears that doesn't play well with .isFuture('datesAndTimes')
. Does that make sense to you? (I apologize for not knowing much about the different versions.)
Assuming I am not able to upgrade my hosting to accommodate using .isFuture()
in my query, is there another way that I could use the End Date in a query parameter that would allow me to only return events with an end date that is today or in the future? I've tried a number of things, but I haven't yet found the proper construction.
I can certainly build a conditional inside a for
loop to only display events that end today or in the future. But that's not the same as having it as a parameter of the query itself.
Thanks for your time.
Hey @mvdesign
I had a look and may have found something you can try: Craft's |filter
filter in twig.
For example:
{% for event in craft.entries.section('events').all()|filter(event => event.dateRangeFieldHandle.isFuture == 1) %}
Let me know how you get on, happy to help if you need any tweaks on the plugin side :)
I admittedly haven't done much with the |filter
filter, and that was just the thing.
In the event that someone else stumbles across this, I ended up using this filter to include ongoing and future events in my list:
|filter(event => event.dateRangeFieldHandle.isOnGoing == 1 or event.dateRangeFieldHandle.isFuture == 1)
Thanks again for listening and for pointing me in the right direction. Have a great weekend!
I hadn’t really used |filter up until this week either 🙂. Happy to see this works, I’ll add it to the readme for people who aren’t on MySQL 5.7 yet (or would rather work this way).
I'm using this plugin for the first time, and I'm running into an unexpected error.
I have a Date Range field with the handle
datesAndTimes
. Ideally, I would like for the events list to show all ongoing or future events. But I'm a little stumped as how to get that to work.To start, I set up a query using the same format as the example in the readme:
But when I do so, I get the following error:
Could you help me sort this out? I'm sure I'm just missing something obvious, but the fact that the example in the readme doesn't work for me made me come here.
I'm happy to send you a larger stacktrace if you need it.
As long as I'm here, I should also say that I'm grateful to you for making this available. It's definitely nicer than rolling my own and it seems perfect for lighter event lists like mine where the more expensive calendar modules would be overkill. So thanks!