Get ready for BLACK FRIDAY shopping starting in

HTML5 Data Bindings Formatter Support Product Page

Changing <span> class depending on before or after current date

Asked 10 Mar 2015 15:43:04
2
have this question
10 Mar 2015 15:43:04 Dik Hendriks posted:
Hello,

Is it possible to apply a different class to dates before or after the current date?

Replies

Replied 13 Apr 2015 23:56:34
13 Apr 2015 23:56:34 Brad Lawryk replied:
How can I change this code to get it to work?

Using the formatter if I hard code in the dates it works fine.

Quote<span class="{{eventStart.between( &quot;2010-01-01&quot;, &quot;2015-04-01&quot; ).then( &quot;eventExpired&quot;, &quot;eventPending&quot; )}}">{{eventStart}}</span>


How can I change the 2015-04-01 to be the current date automatically?
Replied 14 Apr 2015 09:55:08
14 Apr 2015 09:55:08 Teodor Kuduschiev replied:
Hi Brad,
Your code should become:

<span class="{{eventStart.between( &quot;2010-01-01&quot;, 'now' ).then( &quot;eventExpired&quot;, &quot;eventPending&quot; )}}">{{eventStart}}</span>

Reply to this topic