Sharepoint list conditional format: highlight whether two columns have the same date

Bai, Junhe 1 Reputation point
2021-07-13T08:50:34.907+00:00

114183-inpng.jpg

If the two date columns are the same, they are highlighted. The following is the Json formula, but it is strange that it does not work.
I turned on the column setting "Include Time", and the two columns are the same.

How should the Json formula be corrected?

{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "@currentField",
"attributes": {
"class": "=if(@currentField == [$Remindermonth],'sp-css-backgroundColor-blockingBackground50', '')"
}
}

Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. JoyZ 18,111 Reputation points
    2021-07-14T02:50:03.987+00:00

    @Bai, Junhe ,

    This is because after you deselect the "Include time" option, the time value will still be stored in this column.

    If the time values in the two columns are different, then deselect the "Include time" option, although the date is the same, the time value still exists and prevents the column formatting from working.

    114412-image.png

    Therefore, we can edit the items, select the same date value as before, in this way, the time value will be removed, and the column formatting will work normally.

    114355-image.png


    If an Answer is helpful, please click "Accept Answer" and upvote it.

    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.


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.