Jul 21 2018 07:55 PM
Is there a way to combine the great "friendly date display format" native to SharePoint Online with custom formatting of the date field using JSON? My goal is to color the date field red when it's prior to the current date, but I'd like it to use the friendly-type values.Choosing "friendly" in the list settings
value displaying like I'm hoping for, minus the color
adding the json to add the color also negates the "friendly" date display format.
Jun 06 2020 03:01 PM
@Ian Bruckner, sorry to dig up an old post, but did you figure out a solution? I'm trying to do the same thing here.
Dec 02 2021 05:19 AM
Hi,
I know, this is an old thread, but answering it in case other people are struggling with this. To achieve this have txtContent value as [$ColumnInternalName.displayValue] not @currentField. For example, my full code is as follows for the column AppSecretExpiration.
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"debugMode": true,
"txtContent": "[$AppSecretExpiration.displayValue]",
"style": {
"color": "=if(Date(@currentField) <= @now, '#ff0000', '')"
}
}
Apr 06 2022 04:00 PM