Hey there!
We have problems with igGrid updating when there are columns of type date.We are setting up the grid using the MVC wrapper and the Updating feature is enabled with EditMode=GridEditMode.Row. The editor type of the date column is set to ColumnEditorType.DatePicker.
We manually submit the changes by serializing the transactions to string with the function "transactionsAsString" and send them to the server. However depending on whether the grid has some data or is initially empty - the date is sent to the server with different time component:
When we load a grid with some records in it and we update a row setting the date to 1991/07/18, when I inspect the grid transactions the date is "Thu Jul 18 1991 03:00:00 GMT+0300 (Eastern European Summer Time)". Thus the serialized date sent to the server as part of the transaction is "1991-07-18T00:00:00.000Z"
When however the grid has no data and we add a new row picking the same date, then the date in the transactions object is Thu Jul 18 1991 00:00:00 GMT+0300 (Eastern European Summer Time) and what is sent to the server is 1991-07-17T21:00:00.000Z.
With older versions of IgniteUI (16.2) the described scenario worked without any problems with dates.
I have attached a sample project demonstrating the problem.
What causes this behaviour and how should we set up the grid and process the transactions (client and server-side) so that dates will always be sent with the same time component (either UTC or local, but not mixing them up)?
igGrid_DateTime_Submit.zip
Thank you for your cooperation. This settings resolved the problem.
However I have difficulties with the igDatePicker control.Again, I'm using the MVC wrapper. I have modified my sample adding an example where the following behavior is observed:
There are two datepickers. From the MVC controller the two DateTime fields are set to values: viewModel.FirstDate = new DateTime(2018, 6, 13);viewModel.SecondDate = new DateTime(1976, 6, 13);
When the view is rendered there is a problem with the date DateTime(1976, 6, 13), which is displayed by the datepicker as 12.06.1976 23:00. The other date is displayed correctly. When the model is submitted without making changes to the dates - the correct dates come to the server.When I change the values of the datepickers to the date (dd.MM.yyyy) 01.01.1950 00:00 - again everything is okay.However when picking for example 01.07.1950 00:00 and submitting, the DateTime on the server is 01.07.1950 1:00:00I tried to experiment with the options EnableUtcDates and DisplayTimeOffset, but couldn't find a working solution where the whole roundtrip of the dates work, no matter which date is chosen.
Can you guide me how to resolve the issue?
igGrid_DateTime_Submit_modified.zip
Hello Veselina,
The issue is represent because the DateDisplayType option of the columns wasn’t set. In the first grid the first date adds timezone property to the grid's data column and uses local timezone.
In order to make the two grid’s timezones equal set both grid configurations the DateDisplayType to DateDisplayType.UTC or to DateDisplayType.Local.
column.For(x => x.StartDate).HeaderText("StartDate").DataType("date").DateDisplayType(DateDisplayType.UTC);
In case you have additional questions don’t hesitate to ask them.
Thank you for the provided sample. I am currently investigating the behavior of the grid and the date column. I will come back to you with an update as soon as possible.
In the meanwhile if you have additional questions feel free to ask them.