A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
Hi Annabel,
Thank you for reaching out.
You can use SharePoint column formatting to make the Due Date column display with a red background when the date is within six months. This formatting only changes the appearance of the column. It will not modify the stored date.
Please follow these steps:
- Open the SharePoint list.
- Select the Due Date column heading.
- Select Column settings.
- Select Format this column.
- At the bottom of the formatting pane, select Advanced mode.
- Remove any existing JSON and paste the following:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"style": {
"background-color": "=if(@currentField == '', '', if(@currentField <= @now + 15811200000, '#d13438', ''))",
"color": "=if(@currentField == '', '', if(@currentField <= @now + 15811200000, 'white', ''))",
"font-weight": "=if(@currentField == '', '', if(@currentField <= @now + 15811200000, '600', 'normal'))",
"padding": "4px 8px",
"border-radius": "4px"
},
"txtContent": "@currentField.displayValue" }
- Select Save.
The Due Date cell will now have a red background and white text when the date is due within approximately six months. Past-due dates will remain red as well. Blank date cells will not be formatted.
I hope this information is helpful. Please try these steps and let me know how it goes. Should you have any further questions, please feel free to reach out and let me know. I'll be happy to help.
Thank you for your time and cooperation.