Coaxing data to dates and comparing?

Galen King's Avatar

Galen King

20 Dec, 2010 02:30 AM via web

Is it possible to compare two fields as dates?

I want to do something like this:

{% capture event_date %}{{ event.day }} {{ event.month }} {{ event.year }}{% endcapture %}
{{ event_date | isodate | assign_to: 'event_date' }}
{{ 'now' | date: '%d %M %Y' | isodate | assign_to: 'today' }}

{% if event_date >= today %}
    ... do something ...
{% endif %}

Any suggestions?

  1. 2 Posted by Jonathan Hoyt on 20 Dec, 2010 02:19 PM

    Jonathan Hoyt's Avatar

    We don't have a date field type yet, but we do have an issue created to get that done. How urgently do you need it? I can bump up the priority on that issue if need be.

  2. 3 Posted by Galen King on 20 Dec, 2010 05:52 PM

    Galen King's Avatar

    Not urgent but pretty important.

    Galen

    Sent from my iPhone

  3. 4 Posted by Jonathan Hoyt on 21 Dec, 2010 02:47 PM

    Jonathan Hoyt's Avatar

    Understood. I'll go ahead and bump up the priority.

  4. Jonathan Hoyt closed this discussion on 21 Dec, 2010 02:47 PM.

Comments are currently closed for this discussion. You can start a new one.

Recent Discussions

17 May, 2012 10:45 PM
20 Mar, 2012 05:05 PM
26 Apr, 2012 01:40 AM
07 Mar, 2012 04:42 PM