Skip to main content
3 of 3
added 522 characters in body
Matiur Rahman
  • 2.7k
  • 2
  • 7
  • 8

Updated to show Traffic Light as circle in the output:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "txtContent": "•",
  "style": {
    "color": "=if([$EndDate]>(@now +259200000), 'Green', if([$EndDate]>@now && [$EndDate]<= (@now +259200000), 'Yellow', 'Red'))",
    "font-size": "5em",
    "justify-content": "center"
  }
}

enter image description here


You can try this:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "txtContent": "=if([$EndDate]>(@now +259200000), 'GREEN LIGHT', if([$EndDate]>@now && [$EndDate]<= (@now +259200000), 'YELLOW LIGHT', 'RED LIGHT'))",
  "style": {
    "background-color": "=if([$EndDate]>(@now +259200000), 'Green', if([$EndDate]>@now && [$EndDate]<= (@now +259200000), 'Yellow', 'Red'))",
    "color": "black",
    "font-size": "1.5em",
    "justify-content": "center"
  }
}

enter image description here

Note: In the formula, 86400000 X 3 =259200000

Please refer to MS Article for Column Formatting

Matiur Rahman
  • 2.7k
  • 2
  • 7
  • 8