2

I am trying to pull entries that match a date criteria. Any ideas why this is not working?

{% set entries = craft.entries({
section: 'leads',
lastAssigned: '("now"|date_modify("-3 days"))'
}) %}

I get the following error.

Fatal error: Call to a member function getTimestamp() on a non-object in .../craft/app/helpers/DbHelper.php on line 597
David A McInnis
  • 1,201
  • 12
  • 26

2 Answers2

1

I believe it's the quotes that is throwing it off. Try this:

{% set entries = craft.entries({
section: 'leads',
lastAssigned: now | date_modify("-3 days")
}) %}
Jameal G
  • 166
  • 7
1

Jameal put me on the right track here. What I actually needed was to select entries where lastAssigned date was more than 3 days old. I accomplished this by.

{% set entries = craft.entries({
    section: 'leads',
    lastAssigned:' <' ~ now |date_modify("-3 days")
}) %}

Posting my solution here because I think this will be helpful to someone in the future.

David A McInnis
  • 1,201
  • 12
  • 26