When I export data from the grid to Excel I'm getting +1hr timezone offsets on some dates, because of DST adjustments in the UK I'm guessing. The dates in my datasource don't have time offsets, so I think the grid (or maybe moment?) is introducing these? How can I turn that off and have the dates exported as they are shown in the grid without time offsets added?
This is a screenshot that shows how the values in the grid differ from the export
Thank you for the detailed information provided.
When receiving data from a backend, the igDataSource class recreates the data on the client as well. When creating date objects on the client though, the date is always created in local time, so this introduces a difference. Though the igGrid is formatting this data based on tne enableUTCDates property, the igGridExcelExporter takes the client data and export it to the Excel worksheet, so in the end we may see such variations as in your case.
Possible resolutions are:
I recommend going for the last approach and I will attach a sample demonstrating how to achieve it shortly.
Here is a sample demonstrating the last approach. Please let me know if you have further questions.
Sorry, I'm a bit confused, why is it introducing a difference? Is that because the server and client are in different timezones, or is there some other reason?
As my example shows, creating a date on the server happens as:
ReleaseDate = new DateTime(2015, 1, 10, 7, 0, 0, 0) // 10.01.2015 07.00 AM
07:00 AM + 3:00 (if the timezone offset on the server is +3 hours) = 10:00 AM
This is the date the igGridExcelExporter works with and it will be exported to the Excel worksheet.
However, since enableUTCDates is true, that date is formatted to UTC (-3:00:00) for displaying in the igGrid:
All of this is explained in more detail at https://www.igniteui.com/help/using-igniteui-controls-in-different-time-zones. Please let me know if you have further questions, I will be glad to help.