Format view json not getting date format correct

%3CLINGO-SUB%20id%3D%22lingo-sub-510116%22%20slang%3D%22en-US%22%3EFormat%20view%20json%20not%20getting%20date%20format%20correct%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-510116%22%20slang%3D%22en-US%22%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20following%20Json%20formatting%20code%20gives%20me%20the%20incorrect%20row%20highlighting%20as%20seen%20below.%20Why%20and%20how%20to%20fix%20it%20please.%7B%26nbsp%3B%20%22schema%22%3A%20%22%3CA%20href%3D%22https%3A%2F%2Fdeveloper.microsoft.com%2Fjson-schemas%2Fsp%2Fview-formatting.schema.json%26quot%3B%2C%26nbsp%3B%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdeveloper.microsoft.com%2Fjson-schemas%2Fsp%2Fview-formatting.schema.json%22%2C%26nbsp%3B%3C%2FA%3E%20%22additionalRowClass%22%3A%20%22%3Dif(%5B%24Order_x0020_Date%5D%26lt%3B%20%5B%24Arrival_x0020_Date%5D%2C'ms-fontColor-neutralSecondary%20ms-fontColor-redDark%20ms-fontSize-mPlus%20ms-fontWeight-bold%20sp-field-severity--blocked'%2C'')%22%7D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-left%22%20style%3D%22width%3A%20176px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F111676iA3AE93E158B6BB47%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%22ApplicationFrameHost_Mf1dwbpo2o.png%22%20title%3D%22ApplicationFrameHost_Mf1dwbpo2o.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-533848%22%20slang%3D%22en-US%22%3ERe%3A%20Format%20view%20json%20not%20getting%20date%20format%20correct%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-533848%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F331610%22%20target%3D%22_blank%22%3E%40shanebekker%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ECan%20you%20try%20the%20below%3F%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%7B%0A%20%20%20%20%22schema%22%3A%20%22https%3A%2F%2Fdeveloper.microsoft.com%2Fjson-schemas%2Fsp%2Fview-formatting.schema.json%22%2C%0A%20%20%20%20%22additionalRowClass%22%3A%20%22%3Dif(%20Date(toDateString(%5B%24Order_x0020_Date%5D))%20%26lt%3B%20Date(toDateString(%5B%24Arrival_x0020_Date%5D))%2C'ms-fontColor-neutralSecondary%20ms-fontColor-redDark%20ms-fontSize-mPlus%20ms-fontWeight-bold%20sp-field-severity--blocked'%2C'')%22%0A%7D%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-536414%22%20slang%3D%22en-US%22%3ERe%3A%20Format%20view%20json%20not%20getting%20date%20format%20correct%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-536414%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F198037%22%20target%3D%22_blank%22%3E%40Shreyansh%20Agrawal%3C%2FA%3E%26nbsp%3B%20Thanks%20for%20replying%20but%20I%20still%20get%20the%20same%20results%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20255px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F112368i0FCAED3B75555327%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22ApplicationFrameHost_Mf1dwbpo2o.png%22%20title%3D%22ApplicationFrameHost_Mf1dwbpo2o.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-539505%22%20slang%3D%22en-US%22%3ERe%3A%20Format%20view%20json%20not%20getting%20date%20format%20correct%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-539505%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F331610%22%20target%3D%22_blank%22%3E%40shanebekker%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ECan%20you%20share%20the%20following%20details%20-%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EField%20type%20for%20Order%20Date%20%26amp%3B%20Arrival%20Date%20%5BDate%20or%20Calculated%20Date%5D%3C%2FLI%3E%0A%3CLI%3EAre%20you%20using%20SharePoint%20OnPrem%20or%20SharePoint%20Online%3C%2FLI%3E%0A%3C%2FOL%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-543736%22%20slang%3D%22en-US%22%3ERe%3A%20Format%20view%20json%20not%20getting%20date%20format%20correct%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-543736%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EUsing%20sharepoint%20lists%20online%20and%20datetime%20fields%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
New Contributor

 

The following Json formatting code gives me the incorrect row highlighting as seen below. Why and how to fix it please.
{
  "schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
  "additionalRowClass": "=if([$Order_x0020_Date]< [$Arrival_x0020_Date],'ms-fontColor-neutralSecondary ms-fontColor-redDark ms-fontSize-mPlus ms-fontWeight-bold sp-field-severity--blocked','')"
}

 

ApplicationFrameHost_Mf1dwbpo2o.png

4 Replies
Highlighted

@shanebekker 

 

Can you try the below?

 

{
    "schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
    "additionalRowClass": "=if( Date(toDateString([$Order_x0020_Date])) < Date(toDateString([$Arrival_x0020_Date])),'ms-fontColor-neutralSecondary ms-fontColor-redDark ms-fontSize-mPlus ms-fontWeight-bold sp-field-severity--blocked','')"
}

 

Highlighted

@Shreyansh Agrawal  Thanks for replying but I still get the same results
ApplicationFrameHost_Mf1dwbpo2o.png

Highlighted

@shanebekker 

 

Can you share the following details -

  1. Field type for Order Date & Arrival Date [Date or Calculated Date]
  2. Are you using SharePoint OnPrem or SharePoint Online
Highlighted

Hi,

 

Using sharepoint lists online and datetime fields