<p>In Twig, you'll never need to double up on your curly brackets.  I.E.</p>

<pre><code>{{ {{ }} }}
</code></pre>

<p>or </p>

<pre><code>{% {{ }} %}
</code></pre>

<p>Change this (which is already inside of <code>{% %}</code>:</p>

<pre><code>event_startDateTime: '&lt;= {{ now }}',
</code></pre>

<p>To use string concatenation like this:</p>

<pre><code>event_startDateTime: '&lt;= ' ~ now,
</code></pre>

<p>And you should be set.</p>

CC BY-SA 3.0
2014-08-06T21:08:38.597Z
2014-08-06T21:08:38.597Z
Brad Bell
<p>The following code is throwing an error for me.</p>

<pre><code>{% set eventEntries = craft.entries.find({
    section: 'events',
    event_startDateTime: '&lt;= {{ now }}',
    limit: '4'
}) %}

{% for entry in eventEntries %}
</code></pre>

<p>Fatal error: Call to a member function getTimestamp() on a non-object</p>

<p>What I'm trying to do is pull 4 events where a date field (event_startDateTime) is before the current time.  My suspicion is that the {{ now }} variable isn't parsing inside the single quotes, but I'm not entirely sure.  Can anyone correct my code?</p>

<elementcriteriamodel>
Problem with Pulling Event Entries
# Problem with Pulling Event Entries

(Asked by: username_0 on 2014-08-06)

The following code is throwing an error for me.
{% set eventEntries = craft.entries.find({
    section: 'events',
    event_startDateTime: '<= {{ now }}',
    limit: '4'
}) %}

{% for entry in eventEntries %}

Fatal error: Call to a member function getTimestamp() on a non-object
What I'm trying to do is pull 4 events where a date field (event_startDateTime) is before the current time.  My suspicion is that the {{ now }} variable isn't parsing inside the single quotes, but I'm not entirely sure.  Can anyone correct my code?

**Tags:** elementcriteriamodel


---

## 1 answers

### Answer by username_1 on 2014-08-06. Score: 2 | Accepted answer

In Twig, you'll never need to double up on your curly brackets.  I.E.
{{ {{ }} }}

or 
{% {{ }} %}

Change this (which is already inside of {% %}:
event_startDateTime: '<= {{ now }}',

To use string concatenation like this:
event_startDateTime: '<= ' ~ now,

And you should be set.


---

