Forum Discussion

StefanGierke's avatar
StefanGierke
Copper Contributor
Aug 08, 2024

SharePoint shows different date values in EditForm and actual SharePoint List

Hello everyone,

 

today we observed a pretty strange behavior of date columns in the new SharePoint lists (= MS Lists layout) in all of our customer tenants. The tenants are in time zone "W. Europe Standard Time" (= UTC + 1) (this is also the setting in the "Regional Settings" of each SharePoint site).

 

When we select a date value before 01.01.1980 and the month is one-digit "1 - 9" (January - September), it shows the date correctly in the EditForm, but in the SharePoint list itself it is displayed in UTC (which means the date is shifted 1 day to our selected date in the EditForm):

 

 

However, this only happens when the month has exactly one digit. If it has two digits (10, 11, 12 = October, November, December), the displayed date values in the EditForm and in the SharePoint list are identical, no matter which year was selected:

 

 

Even more strange is that the problem with the date differences does not occur when you select a date with a one-digit month in the years 1916, 1917, 1918, 1940 - 1949 or after 01.01.1980:

 

 

This seems to be a bug in Microsoft backend. We are able to reproduce this issue in any tenant where the regional settings of the SharePoint site are in UTC+1.

 

Does anyone of you has the same problem in your tenant?

 

Best regards,

Stefan

    • StefanGierke's avatar
      StefanGierke
      Copper Contributor

      Viktor 

      We raised a ticket and the Microsoft support told us that they were able to reproduce this issue in their own enrivonments. Their suggestion for a workaround was to set the time zone on UTC-9 or a time zone where UTC and the selected time zone are in the same date range (unlike UTC and W. Europe Standard Time).

       

      However, that is not a suitable way for us. Therefore, we created our own temporary fix by using this JSON formatter for our date columns in SharePoint (as long as Microsoft does not solve the bug):

      {
        "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
        "elmType": "div",
        "txtContent": "=toLocaleDateString(@currentField+2*60*60*1000)"
      }

      This JSON code adds 2 hours to the UTC date in the date column, which is in summer and winter time always enough for "W. Europe Standard Time" to show the correct local date. By that, the date in the EditForm and in the actual list column are always identical.

       

      • Viktor's avatar
        Viktor
        Copper Contributor
        That seems to be a good workaround. Thanks.
  • admin2208's avatar
    admin2208
    Copper Contributor
    Hello, i am admin for O365, i am facing one problem when i create Teams/SharePoint channel and upload data it is not uploading properly most of the folders are missing might be due to long character limit. Please help me with this on priority.

Resources