Forum Discussion

Jorge0008's avatar
Jorge0008
Copper Contributor
Jul 21, 2022

Expiration date after a set time

I'm trying to make a formula that will change the color of the date to red if the date is older than 180 days from @now to Yellow if the date is older than 150 from @now and to Green if the date is less than 149 dates old.

 

I been trying lots of different formulas with no joy they only turn one color.

 

I tried modifying this one to do what i was but this one only those it to future dates no passed.

 

{
    "elmType""div",
    "txtContent""@currentField",
    "style": {
        "background-color""=if(Number(@currentField) == 0, '', if(@currentField >= @now + 2592000000, '#AFF8C9', if(@currentField >= @now + 86400000, '#EEBB2F', if(@currentField <= @now, '#F06C47',''))))"
    }
}

 

 

Resources