<p>An empty date field will return <code>null</code>. Your conditional is slightly off as you have an <code>elseif</code> straight after your first <code>if</code>. Try:</p>

<pre class="lang-twig prettyprint-override"><code>{% if entry.eventStartDate is empty %}
    There is no date set.
{% elseif entry.eventStartDate &gt; now %}
    There is a date and it's greater than now.
{% elseif entry.eventStartDate &lt; now %}
    There is a date and it's before now.
{% endif %}
</code></pre>

CC BY-SA 4.0
2020-03-06T15:59:00.527Z
Absolutely bang on.
JMKelley
CC BY-SA 4.0
2020-03-06T14:03:46.583Z
2020-03-06T14:03:46.583Z
Oli
<p>I currently have an empty date field, it's unset in the field. I know from reading this becomes "Today's Date" but for some reason the following code is just not working when testing for <code>empty</code>? Unsure why this is?</p>

<pre><code>{% if entry.eventStartDate is not empty %}

  {% elseif entry.eventStartDate &gt; now %}
    There is a date and it's greater than now.

  {% elseif entry.eventStartDate &lt; now %}
    There is a date and it's before now.

  {% else %}
    There is no date set.
{% endif %}
</code></pre>

CC BY-SA 4.0
2020-03-06T13:40:35.083Z
What's the output of {{ dump(entry.eventStartDate) }}?
Paul
<templating><datetime>
Empty Date Field
# Empty Date Field

(Asked by: username_0 on 2020-03-06)

I currently have an empty date field, it's unset in the field. I know from reading this becomes "Today's Date" but for some reason the following code is just not working when testing for empty? Unsure why this is?
{% if entry.eventStartDate is not empty %}

  {% elseif entry.eventStartDate > now %}
    There is a date and it's greater than now.

  {% elseif entry.eventStartDate < now %}
    There is a date and it's before now.

  {% else %}
    There is no date set.
{% endif %}

**Tags:** templating, datetime
> **Comments:**
> **username_1**: What's the output of {{ dump(entry.eventStartDate) }}?  

---

## 1 answers

### Answer by username_2 on 2020-03-06. Score: 2 | Accepted answer

An empty date field will return null. Your conditional is slightly off as you have an elseif straight after your first if. Try:
{% if entry.eventStartDate is empty %}
    There is no date set.
{% elseif entry.eventStartDate > now %}
    There is a date and it's greater than now.
{% elseif entry.eventStartDate < now %}
    There is a date and it's before now.
{% endif %}

> **Comments:**
> **username_0**: Absolutely bang on.  

---

