SharePoint / SharePoint/sp-dev-docs

List Formatting - setValue and @now sets wrong date for EN-IE locale

Open
#9,474 8 comments 0 reactions 1 assignee View on GitHub

@Ashlesha-MSFT is already working on this.

Since Jul 2, 2025.

area:list-formatting sharepoint-developer-support type:bug-confirmed type:bug-suspected
Dominant language
PowerShell
Stars
1.4k
Forks
1.1k
Avg merge
4d 12h
Merged PRs (30d)
12

Description

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

Declarative list formatting

Developer environment

Windows

What browser(s) / client(s) have you tested
  • 💥 Internet Explorer
  • 💥 Microsoft Edge
  • 💥 Google Chrome
  • 💥 FireFox
  • 💥 Safari
  • mobile (iOS/iPadOS)
  • mobile (Android)
  • not applicable
  • other (enter in the "Additional environment details" area below)
Additional environment details

Windows version with default locale to EN-IE, browser the same.

Describe the bug / error

When using the setValue functionality in list formatting and the @now token to set date and time, seems it always converts to american format, even when the browser locale/site settings are in other locale (EN-IE in my case).

For example, if @now was 12th of January 2024, it would be setting the value to 1st of December 2024.

And today as it is 23rd of January, as it seems that the function would use 23 as the month, I get an error:
image

When using a string on UTC format like in this sample I submitted, everything works fine:
https://github.com/pnp/List-Formatting/tree/master/column-samples/date-button-setValue-today

Steps to reproduce
  1. Create a Date Field named 'DateTripCompleted' in a List
  2. Apply below formatting JSON to the field
  3. Add a list item without a a value in this field
  4. Click the button displayed in the Field from the List View
    { "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "children": [ { "elmType": "span", "txtContent": "[$DateTripCompleted.displayValue]", "attributes": { "class": "ms-fontColor-themePrimary ms-fontColor-themeDarker--hover" }, "style": { "display": "=if(Number([$DateTripCompleted]) ==0,'none','flex')" } }, { "elmType": "button", "customRowAction": { "action": "setValue", "actionInput": { "DateTripCompleted": "@now" } }, "attributes": { "class": "ms-fontColor-themePrimary ms-fontColor-themeDarker--hover" }, "style": { "border": "none", "background-color": "transparent", "cursor": "pointer", "display": "=if(Number([$DateTripCompleted]) ==0,'flex','none')", "align-items": "center" }, "children": [ { "elmType": "span", "attributes": { "iconName": "EventAccepted" }, "style": { "padding-right": "6px" } }, { "elmType": "span", "txtContent": "Mark Trip as Complete" } ] } ] }
Expected behavior

Value of date field to be set correctly.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.