I have a simple renewal list that has a date column this date column I would like to change color depending on these criteria.
- If the date is within the next 14 days - Yellow
- If the date matches today's date or is older - Red
I've have created the following JSON:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "@currentField",
"attributes": {},
"style": {
"box-sizing": "border-box",
"padding": "0 5px 5px",
"background-color": {
"operator": "?",
"operands": [
{
"operator": "<=",
"operands": [
"[$Renewal_x0020_Date]",
"@now"
]
},
"#fac3c3",
{
"operator": "?",
"operands": [
{
"operator": "<=",
"operands": [
"[$Renewal_x0020_Date]",
{
"operator": "+",
"operands": [
"@now",
1209600000
]
}
]
},
"#ffe682",
""
]
}
]
}
},
"children": []
}
That basically does what I need but I've noticed when a field doesn't have a date set that field is shaded Red like so:
I am assuming this is happening as even though it looks empty SharePoint date columns have the 1/1/1900 default date? Is there an easy way to exclude any fields that are "empty"?