JSON formula is not working

Olga Schmitt 20 Reputation points
2024-11-19T18:26:29.4633333+00:00

This formula will:

  1. Highlight in Yellow if the date is past due (i.e., the date in the column is in the past).
  2. Highlight in Orange if the date is within the next 14 days.
  3. Highlight in Yellow again for dates within 30 days.
  4. Light Gray for any dates beyond 30 days.

Updated JSON Formula:

json
Copy code
{
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
3,071 questions
{count} votes

Accepted answer
  1. Xyza Xue_MSFT 25,806 Reputation points Microsoft Vendor
    2024-11-20T02:38:33.41+00:00

    Hi @Olga Schmitt ,

    Thank you for posting in this community.

    Using the follow json to display date column in different colors according to time:

    {
      "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
      "elmType": "div",
      "txtContent": "@currentField",
      "style": {
        "background-color": "=if(((@currentField) - @now <= 0) || (((@currentField) - @now <= 2592000000) && ((@currentField) - @now >= 1209600000)), 'yellow', if((@currentField) - @now <= 1209600000, 'orange', 'gray'))"
      }
    }
    

    User's image


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.