Dynamic style change issue

Not sure if I am missing something here but I’m trying to get a text colour changes on conditions

<p class="mb-0" dmx-text="'Licence&nbsp;'+customer_selected.data.query1.cust_licence_number+'&nbsp;Exp:&nbsp;'+customer_selected.data.query1.cust_lience_exp.formatDate(&quot;dd-MM-yy&quot;)"
					dmx-class:text-success="(var1.datetime.formatDate(&quot;dd-MM-yy&quot;) <= customer_selected.data.query1.cust_lience_exp.formatDate(&quot;dd-MM-yy&quot;))"
					dmx-class:text-danger="(var1.datetime.formatDate(&quot;dd-MM-yy&quot;) >= customer_selected.data.query1.cust_lience_exp.formatDate(&quot;dd-MM-yy&quot;))"></p>

Not sure if I am missing something but this is just not working and stays text-success even if the date is less than todays date.
Any advice would be appreciated. :slight_smile:

You cannot have two class properties for the one element.

The way out is to either use custom code or duplicate paragrapgh with different colours with one showing when the condition is met.

that makes sense, cheers @ben

Just realised that you could do something like
<p class="mydanger" dmx-class:text-success="((var2.datetime + 1) >= var2.datetime)">{{var2.datetime}}</p>

where .mydanger has a colour of red or similar.

1 Like

Yep, though about that one as well, going to try it soon. Hopefully will work :slight_smile: