Forum Discussion

spinman's avatar
spinman
Tin Contributor
Dec 16, 2019
Solved

Formatting Dates in SharePoint Online list

I have a list with two dates one labeled "Effective Date" and one labeled "Exp Date". Both columns are using the Date & Time column type but set to Date Only.  What I'm trying to figure out is how to...
  • Robin Nilsson's avatar
    Robin Nilsson
    Dec 17, 2019
    The logic in the JSON doesn't seem to match what you asked for - what it is doing is showing Effective Date green if the Effective Date is less than ExpDate+1month, red if it's after that.
    You seem to want Effective Date green if the ExpDate is less than a month away, and red if it's after the ExpDate... That's more complex logic. I'm not that great in JSON, but in pseudo logic it would be something like

    If EffectiveDate < ExpDate and EffectiveDate >= ExpDate-1month show green
    If Effective Date > ExpDate and EffectiveDate <= ExpDate+1month show red