Search code examples
modxmodx-revolution

how to use conditional output filter for date field


I have a resource with TV "date". I want the content to be shown only if the field "date" is greater than the current time. I have a snippet called !curDate that returns unix timestamp. My code is:

[[*date:strtotime:ge=`[[!curDate]]`:then=`display:block;`]]

this example does not work, but this one works:

[[*date:strtotime:ge=`0`:then=`display:block;`]]

Is there any way to use output filters for date fields?


Solution

  • Looks like it should work as you have it, my only guess at that is that your curDate snippet is not returning a timestamp?

    You could try to put all your logic in the curDate snippet and just pass the TV in...

    [[!curDate? &date='[[*date]]']]

    Do your date comparison in there and just return "display:block" [or whatever]