1

I am grabbing a date range from a URL query string like so:

https://website.com/qa/search-feedback-results?datestart=2019-01-01&dateend=2019-02-26

I can't figure out how to include posts that were submitted on the end date that is in the range. In the above example, any posts dated 2019-02-26 are not showing up in my results.

Here's my code:

{% set vDatestart = craft.app.request.getParam('datestart')|date('Y-m-d') %}
{% set vDateend = craft.app.request.getParam('dateend')|date('Y-m-d') %}
{% set vParams = vParams|merge({ postDate: ['and', '>= ' ~ vDatestart, '<= ' ~ vDateend] }) %}
2

have you tried setting a time for the end date? because I think Craft always saves time with your date fields.

{% set vDateend = craft.app.request.getParam('dateend')|date('Y-m-d') ~ ' 23:59:59' %}

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.