Error on formating date type

I'm using Grid on my app, i receive from an API some fields with a date value

im using the standar format, like this:

field: col.fieldId,
headerText: col.label,
groupId: headCol.columnGroupId,
visible: !(headCol.hidden ? true : col.hidden),
width: col.width || 120,
minWidth: 50,
maxWidth: 250,
type: formatChooser(col.valueFormat as string),
format:
col.valueFormat === 'date'
? 'dd/MM/yyyy'
: formatter(col.valueFormat as string, col.showableDecimalDigits || 4),
textAlign: col.horizontalAlign ? (capitalize(col.horizontalAlign) as TextAlign) : undefined,
};


the way I use works, but i receive for example 2022/08/31, but into the grid i see this 30/08/2022, the format mode is decreasing 1 day on format, theres a solution for this? Im Using React with Typescript functional components, NO CLASSES!!!



1 Reply

JC Joseph Christ Nithin Issack Syncfusion Team August 31, 2022 07:00 PM UTC

Hi Fernando,


Thanks for your update


We have validated your query and understood that you need to show date value without timeZone conversion. You can achieve your requirement by using serverTimeZoneOffset. Please refer the below code example for more information.


 

 

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

 

// by using serverTimeZoneOffset we can convert the time to any timeZone

DataUtil.serverTimezoneOffset = 0; // 0 means UTC Time (here you can set the value as you want)

 

 


Sample: https://stackblitz.com/edit/react-xa25ij-wlscpc?file=component%2Fapp.jsx


Please let us know if you have any concerns.


Regards,

Joseph I.


Loader.
Up arrow icon