2

Craft has changed since the above answer was given. The now object must be a part of the string, rather than concatenated as an object. so instead of: {% set futureEntries = craft.entries.section('events').dateAndTime('>= ' ~ now) %} use: {% set futureEntries = craft.entries.section('events').dateAndTime('>= now') %}


2

You can use the LAST_DAY function if you're working with MySQL. To only get entries with a postDate on the last day of the month, you can check if LAST_DAY(postDate) is identical with DATE(postDate). {% set lastDayOfMonthEntries = craft.entries() .andWhere('LAST_DAY([[postDate]]) = DATE([[postDate]])') .all() %} Add further query parameters to limit ...


2

What an idiot. I almost never use Advanced element queries which is why it never popped into my head I guess. So you can add where() and orWhere() into your standard craft.entries calls. So my code becomes {% if craft.app.request.getParam('departure') | length %} {% for dept in craft.app.request.getParam('departure') %} {% set lastDay = dept [0:7]...


1

Found it: the reason for the Exception is, that the dynamic method productStartDate (coming from the CustomFieldBehavior) needs an Array as parameter. I have no clue why I get this misleading Exception though... So finally, this works: use craft\commerce\elements\Product; $product = Product::find() ->type('ticket') ->...


Only top voted, non community-wiki answers of a minimum length are eligible