Comparing dates

Hi ,

i am trying to compare 2 dates against each other , its not working , i am setting one date using the date picker plugin using the default time format , and comparing it against <>

what could i be doing wrong , the filter always results to an empty message

<$set name="enddate" value={{{ [{!!endd}] }}}>
<$let outcome={{{ [<<now YYYY0MM0DD0hh0mm0ss0XXX>>compare:date:gt<<enddate>>then[yes]else[no]] }}}>

<br><$list filter="[<outcome>match[yes]]"emptyMessage="less" >greater</$list>

Within filter syntax, brackets (whether square, curly, or angled) are not doubled. Thus:

<$set name="enddate" value={{{ [{!!endd}] }}}>
<$let outcome={{{ [<now YYYY0MM0DD0hh0mm0ss0XXX>compare:date:gt<enddate>then[yes]else[no]] }}}>
<br><$list filter="[<outcome>match[yes]]" emptyMessage="less">greater</$list>

Notes:

  • Instead of using a $set widget, you could write:
    <$let enddate={{{ [{!!endd}] }}}>
    or just
    <$let enddate={{!!endd}}>
    (note the doubled curly braces since the field reference is not inside a filter)

  • You could even eliminate the $let widget entirely and just write:
    <$let outcome={{{ [<now YYYY0MM0DD0hh0mm0ss0XXX>compare:date:gt{!!endd}then[yes]else[no]] }}}>

1 Like

Thank you for the information eric