Forum Discussion
AdmiralS
May 11, 2020Copper Contributor
JSON for Formatting Dates
I currently have a SharePoint list that we use for tracking Insurance Policy Expiration dates. I would like it to format with the warning format for dates that are within the next 30 days. I have r...
RobElliott
May 11, 2020Silver Contributor
AdmiralS wow, reading all that JSON would give me a headache. You can color-code your cells where the expiration date is within the next 30 days by using the following short JSON to add a background color. Note that it requires the date comparison to be in milliseconds! My column is named NextReview:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "div",
"txtContent": "@currentField",
"style": {
"background-color": "=if([$NextReview] <= @now + 2592000000, '#ff9a00','#dddeee')",
"color": "white",
"padding-left": "10px"
}
}
Rob
Los Gallardos
Microsoft Power Automate Community Super User.