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


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] }) %}

1 Answer 1


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 and acknowledge you have read our privacy policy.

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