Are DateTime fields automatically converted to local time zone in a Grid?

The following posts seem to have differing opinions on the subject.


I assumed that the Grid did not do anything automatic to date fields as I have never seen anything in the documentation regarding date fields (other than formatting, e.g. dd-MMM-yyyy).

1 Reply

SI Santhosh Iruthayaraj Syncfusion Team May 22, 2023 01:36 PM UTC

Hi Matthew,


Greetings from Syncfusion support.


Sorry for the delayed response. Based on your query, the Grid doesn't automatically perform any conversions on DateTime fields based on the local timezone. However, you have the option to customize the timezone using the serverTimezoneOffset property of the DataUtil class. By setting this property, you can ensure that the Grid considers the appropriate timezone offset for your application.


Here is a code snippet that demonstrates how to set the serverTimezoneOffset property:


[index.ts]

 

import { DataUtil from '@syncfusion/ej2-data';

 

DataUtil.serverTimezoneOffset = new Date().getTimezoneOffset();

 


Sample: https://stackblitz.com/edit/un9ny4-g2q7qu?file=index.ts


We hope this information addresses your concern. If you have any further questions or need additional assistance, please feel free to reach out to us.


Regards,

Santhosh I


Loader.
Up arrow icon