Conditional Formatting for Dates using JSON
Hello,
I am trying to use conditional formatting for MS List. I specifically want the background colour of the date to change based upon the number of days over since the file was received. Something along the lines of 30 days = yellow, 60 days = orange, and 90 days = red. After searching here and elsewhere I’ve managed to put together some JSON that I believe should work, but alas it does not. There is no error shown, but the table appears untouched. Any help is appreciated.
This is what I have so far:
{
“$schema”: “https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json”,
“elmType”: “div”,
“txtContent”: “@currentField”,
“style”: {
“background-color”: “=””=if([$DateReceived] <= @now + 7776000000, if([$DateReceived] <= @now + 5184000000, if([$DateReceived] <= @now + 2592000000 ‘sp-css-backgroundColor-red’, ‘sp-css-backgroundColor-BgOrange’, ‘sp-css-backgroundColor-warningBackground40’), ”)”)))”,
“padding-left”: “10px”
}
}
Hello, I am trying to use conditional formatting for MS List. I specifically want the background colour of the date to change based upon the number of days over since the file was received. Something along the lines of 30 days = yellow, 60 days = orange, and 90 days = red. After searching here and elsewhere I’ve managed to put together some JSON that I believe should work, but alas it does not. There is no error shown, but the table appears untouched. Any help is appreciated. This is what I have so far: {
“$schema”: “https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json”,
“elmType”: “div”,
“txtContent”: “@currentField”,
“style”: {
“background-color”: “=””=if([$DateReceived] <= @now + 7776000000, if([$DateReceived] <= @now + 5184000000, if([$DateReceived] <= @now + 2592000000 ‘sp-css-backgroundColor-red’, ‘sp-css-backgroundColor-BgOrange’, ‘sp-css-backgroundColor-warningBackground40’), ”)”)))”,
“padding-left”: “10px”
}
} Read More