Jan 20 2022 01:56 PM
I am trying to highlight all rows that have been added to my list in the last three days. The code below is what displays when I choose "on or after" "today". What I really want is "on or after" "today minus two days". How do I update my code to do this?
Jan 22 2022 03:04 AM
@vballnewman you can do this with shorter and easier to understand JSON as follows. You'll see that date comparisons are done with milliseconds:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"style": {
"background-color": "=if(@currentField >= @now-172800000,'#ffa558', '')"
},
"children": [{
"elmType": "span",
"style": {
"display": "inline-block",
"padding": "0 4px"
},
"attributes": {
"iconName": "=if(@currentField >= @now-172800000,'FavoriteStar', '')"
}
},
{
"elmType": "span",
"txtContent": "@currentField"
}
]
}
which results in:
Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)