I'd like to create a column formatting where values should be: Green if expiration date > now()+60 days Yellow if expiration date < now()+60 days and > now() Red if expiration date <= now() No color if Expiration date column is empty.
I've created this JSON but it doesn't work (the blank date column is still in red color):
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"attributes": {
"class": "= if([$Visa_Expiration] = '', 'sp-field-severity--good' , if([$Visa_Expiration] <= @now+86400000*60 && [$Visa_Expiration] > @now , 'sp-field-severity--warning', if([$Visa_Expiration] <= @now, 'sp-field-severity--blocked', if([$Visa_Expiration] > @now+86400000*60, 'sp-field-severity--good', 'sp-field-severity--good') ) ))"
},
"children": [
{
"elmType": "span",
"style": {
"display": "inline-block",
"padding": "0 4px"
},
"attributes": {
}
},
{
"elmType": "span",
"txtContent": "@currentField"
}
]
}
Any Ideas?
Rodolfo