1

I've tried to follow a ton of other articles posted on Stackoverflow for showing posts between 2 dates. I just can't seem to get it working and I keep getting an error of: Call to a member function getTimestamp() on boolean

{% set startDate = now | date_modify('first day of ' ~ qFilter) %}
{% set endDate = startDate | date_modify('+ 1 month') %}
{% set entries = craft.entries.section('events').postDate('<= startDate').expiryDate('>= endDate') %}

(qFilter is a url param: eg "May")

I'm trying to show posts that were live during a certain month.

2

You are passing a string <= startDate to the field parameter, but you actually want it to be a string <= 2016-01-01, which you can get by concatenationg the <= string with the datetime variable. So change your parameters like so:

postDate('<= ' ~ startDate) instead of
postDate('<= startDate')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.