Forum Discussion
Gareth Jayne
Oct 12, 2018Copper Contributor
Modern List View Formatting with UK Dates
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:
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:
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.
- Dr01dyCopper Contributor
Did you ever manage to resolve this? Facing the same issue and not sure how to proceed.
- RobElliottSilver Contributor
Dr01dy you can do this with the built-in view formatting to highlight items on or before today:
Rob
Los Gallardos
Microsoft Power Automate Community Super User- Dr01dyCopper Contributor
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.