Modern List View Formatting with UK Dates

Copper Contributor

Hi everyone

 

I'm trying to use the new view formatting in the Modern UI lists and am coming up against an issue with the date format.  I want to colour all rows red where the Due Date column value is equal to or past today's date using the following code:

 

{ "schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json", "additionalRowClass": "=if([$Due_x0020_Date] <= @now && [$Status] == '1 - Open', 'sp-field-severity--severeWarning', '')" }

 

My sites are UK-based so the date format is dd/mm/yyyy.  However when the formatting is being applied it seems to be looking at the date in the US format of mm/dd/yyyy.  With the UK format set for my site the item with a due date of 11/10/2018 doesn't appear as red:

 

UK Format.PNG

 

However, if I change the site settings to use the US date format it recognises that this date (11th October) has passed and colours the row red:

 

US Format.PNG

As my site date settings need to stay as UK format, is there a way I can add any code to my formatting to force it to recognise the date as the UK format?

 

I'd be grateful for any assistance anyone can give.  Thanks in advance.

 

5 Replies

@Gareth Jayne 

Did you ever manage to resolve this? Facing the same issue and not sure how to proceed.

@Dr01dy you can do this with the built-in view formatting to highlight items on or before today:

viewFormat-BeforeToday.png

 

Rob
Los Gallardos
Microsoft Power Automate Community Super User

@RobElliott 

This still seems to treat the today as an american date. See screen cap below where dates that fit the next review date is after today criteria do not get their background changed to green.

Capture.PNG

 

 

@Dr01dy my screenshot showed the formatting where everything was in UK date format. So I'm not sure why it would be different for you unless something in your regional settings is not set correctly.

 

Rob
Los Gallardos
Microsoft Power Automate Community Super User

@RobElliottThese are my region settings for the site. As far as I am aware this is correct.

 

Capture.PNG