Forum Discussion
JSON formatting a list view in SharePoint
- Oct 24, 2019
After some research, I've found a solution.
We can user the toLocaleDateString() to extract just the date.
so my expression would be-
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "@currentField",
"style": {
"color": "=if(toLocaleDateString[$DueDate]<toLocaleDateString(@now), '#ff0000',if(toLocaleDateString[$DueDate]==toLocaleDateString(@now),'#ffcb0d',''))"
}
}
After some research, I've found a solution.
We can user the toLocaleDateString() to extract just the date.
so my expression would be-
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "@currentField",
"style": {
"color": "=if(toLocaleDateString[$DueDate]<toLocaleDateString(@now), '#ff0000',if(toLocaleDateString[$DueDate]==toLocaleDateString(@now),'#ffcb0d',''))"
}
}