sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

List Formatting - Different dates are returned by the getDate operator depending on the time zone of the computer

Open tecchan1107 opened this issue 1 year ago • 6 comments

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
  • [X] 💥 Microsoft Edge
  • [X] 💥 Google Chrome
  • [ ] 💥 FireFox
  • [ ] 💥 Safari
  • [ ] mobile (iOS/iPadOS)
  • [ ] mobile (Android)
  • [ ] not applicable
  • [ ] other (enter in the "Additional environment details" area below)

Additional environment details

No response

Describe the bug / error

I have observed that changing the time zone of the computer changes the value retrieved by the getDate operator and also retrieves a different value than the date in the date column.

image

Related Document: Formatting syntax reference

Steps to reproduce

Setting up a list for verification

  1. Create a date column with the internal name Date in the list
  2. Set any date in the column created in step 1
  3. Create a column to display the values retrieved by the getDate operator
  4. Set the following JSON to the column formatting created in step 3
{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "txtContent": "=getDate([$Date])"
}

image

Change computer time zone

  1. Change computer time zone from UTC+09:00 to UTC-09:00 image

  2. When the list is reopened, the value obtained with the getDate operator is not the same as before the time zone change, and is different from the date in the date column image

Expected behavior

The getDate operator returns the date of the referencing date sequence without being affected by the computer's time zone.

tecchan1107 avatar Apr 04 '24 04:04 tecchan1107

For reference, I also send a screenshot of the time zone setting for the site.

image

tecchan1107 avatar Apr 04 '24 04:04 tecchan1107

Hello @tecchan1107, Thank you for bringing this issue to our attention. Could you please confirm if the issue still persists for you? We will look into it and get back to you shortly.

Amey-MSFT avatar Jun 26 '25 10:06 Amey-MSFT

@Amey-MSFT

Could you please confirm if the issue still persists for you?

Yes, the issue is still happening.

Image

Image

tecchan1107 avatar Jun 27 '25 05:06 tecchan1107

Hello @tecchan1107 We were able to reproduce the issue, and we are investigating it. We have logged this as a bug, and our engineering team will look into it. Thank you!

Amey-MSFT avatar Jul 03 '25 12:07 Amey-MSFT

Hi @tecchan1107, Thank you for sharing the details about the date issue with the getDate operator. I have tried to reproduce the behavior by changing both the computer and site time zones to UTC+9, but I wasn’t able to observe the issue on my end.

Could you please confirm if you are still able to reproduce this issue consistently? Also, do you think any page refresh or caching might be affecting the results when testing?

Image

Ashlesha-MSFT avatar Sep 16 '25 08:09 Ashlesha-MSFT

Hi @Ashlesha-MSFT .

Could you please confirm if you are still able to reproduce this issue consistently?

This issue could still be reproduced.

Image

Image

Below are the steps to reproduce the issue.

Reproduction Steps
  1. Set the site's time zone to UTC+09:00
Image
  1. Set the local PC's time zone to UTC+09:00
Image
  1. Create a list

  2. Create a Date column with the internal name Date

  3. Create items

  4. Create a column for formatting and set the following JSON:

    {
      "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
      "elmType": "div",
      "txtContent": "=getDate([$Date])"
    }
    
Image
  1. Set the local PC's time zone to UTC-10:00
Image
  1. Check the list
Image

Also, do you think any page refresh or caching might be affecting the results when testing?

I don't think they're having any effect.

tecchan1107 avatar Sep 18 '25 07:09 tecchan1107