Filtering orders by date bring wrong results I'm having a problem with wrong results when filtering order by date.

I use this code:

{% set orders = craft.commerce.orders.dateOrdered(' &gt;= 2016-07-01 00:00:00').dateOrdered(' &lt;= 2016-07-01 23:59:59').find() %}


The last order has been placed on 2016-06-29, and there has been no orders placed on 2016-07-01, so I would expect order to have no results. However it just lists all orders in the system.

If I change the date to 2016-06-10, the result is empty - as expected.

Is this bug in Craft / Craft Commerce, or do I miss something?

How do I make sure I get no results, if there have been no orders on this date?
Try something like:

{% set firstDayOfMonth = year ~ "-" ~ month ~ "-01" %}
{% set daysInThisMonth = firstDayOfMonth|date('t') %}
{% set lastDayOfMonth  = year ~ "-" ~ month ~ "-" ~ daysInThisMonth %}

{% set thisMonthsOrders = craft.commerce.orders.dateOrdered('and', '&gt;= ' ~ firstDayOfMonth, '&lt;= ' ~ lastDayOfMonth) %}