Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
45
Igx-grid UTC Dates
posted

Good evening,

we have a igx-grid with columns that are defined as Date - we need to select the date and it needs to be transmitted as such to the server with the data.


We also supplied them with pipeArgs and timezone 'UTC'.

However when we add a row and send IGridEditEventArgs.newValue to the backend, the object contains the time in local timezone.

This leads to the following problem:

* We select the date 24.12.2023 in the grid - the grid represents it as 24.12.2023 00:00:00.

* The Date in the IGridEditEventArgs however is the date 23.12.2023 23:00:00 GMT+1 (so because of the timezone, the date is changed completely, also because the backend handles all times as UTC). However we want to sent 24.12.2023 to the Backend  - The date we selected.

The only solution right now is to intercept the GridEditEvent and change the date "manually" for all dates.

Is there a way like EnableUTCDates? Or to set the picked date to not include the time?

  • 1700
    Offline posted

    Hello Thomas, 

    Unfortunately, there is no such property as EnableUTCDates, that would allow you to convert the dates obtained by the grid to UTC automatically. 

    I believe that the approach you have taken by handling the rowEditDone is the best approach, since it allows you to modify the date fields and set the correct date in UTC format. 

    Please let me know if you need any further assistance. 

    Regards,
    Ivan Kitanov