HTML5 Data Bindings Formatter Support Product Page

Answered

format of div based on date

Asked 22 Nov 2016 13:18:18
1
has this question
22 Nov 2016 13:18:18 dennis bates posted:
I'm trying to format a element based on the date specifically I want a link to turn green 7 days before a deadline.

<div class="{{primary1.where( "primary1.dateDiff( &quot;days&quot;, &quot;&quot; )", "<=", 7 ).then( "bg-success", "bg-danger" )}} ">{{primary1}}</div>

Ive tried this but it doesn't work
any ideas??

thanks dennis

Replies

Replied 22 Nov 2016 14:58:01
22 Nov 2016 14:58:01 Teodor Kuduschiev replied:
Hello Denis,
You cannot use where filter like that. The where filter is only for collections. What you need to do is t add the following filters:
dateDiff (days)
between (lower limit 0; upper limit 7)
then(if valid: bg-success; otherwise: bg-danger)
Replied 23 Nov 2016 08:10:33
23 Nov 2016 08:10:33 dennis bates replied:
Thank you very much I will try that

Reply to this topic