Forum Discussion
alandarr
Apr 10, 2020Brass Contributor
Quick JSON formula question regarding date plus 365
I am trying to format a column to change color if TODAY is greater than the date entered, plus 365 days. It's basically to show a color for expiration of date entered. Below is what I was trying to figure out, but this doesn't work. Thanks!
{
"schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
"additionalRowClass": "=if(@now()+365 > [$COLUMN_x0020_NAME], 'sp-field-severity--severeWarning', '')"
}
Is this what you are looking for?
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "div",
"txtContent": "@currentField",
"attributes": {
"class": "=if([$DateColumn] >= @now + 365, 'ms-fontColor-themePrimary ms-fontWeight-bold', '')"
}
}I hope this helps.
Norm
10 Replies
Is this what you are looking for?
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "div",
"txtContent": "@currentField",
"attributes": {
"class": "=if([$DateColumn] >= @now + 365, 'ms-fontColor-themePrimary ms-fontWeight-bold', '')"
}
}I hope this helps.
Norm
- alandarrBrass ContributorYes that works! I was originally wanting the background to change, but changing the text works great. Many thanks for your help!