View Full Version : [CLOSED] GridPanel DateColumn off by -4 hours

Apr 19, 2017, 5:08 PM
I guess I could just add 4 hours to all datetimes, but thinking this must be some system configuration or settings that is causing this?

<%@ Page Language="vb" %>

<script runat="server">
Private Class GridDTO
Property ID As Integer
Property LastPublished As Date?
Property ChangeGuidance As String
End Class

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack AndAlso Not Ext.Net.X.IsAjaxRequest Then
Dim data As New List(Of GridDTO)
Dim X = New GridDTO With {.ID = 1, .LastPublished = Now, .ChangeGuidance = ""}
X = New GridDTO With {.ID = 2, .LastPublished = Now, .ChangeGuidance = "Test Guidance"}
X = New GridDTO With {.ID = 3, .LastPublished = Now, .ChangeGuidance = ""}

storeVerification.DataSource = data
End If

End Sub


<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Edit Grid</title>
<form id="Form1" runat="server">
<ext2:ResourceManager ID="ResourceManager1" runat="server" />

<ext2:Panel Title="Model Change Verification" runat="server" ID="pnlVerification">

<ext2:GridPanel Title="Allocation Changes" runat="server" ID="grdAllocationsVerification" AutoScroll="true">
<ext2:Store ID="storeVerification" runat="server" >
<ext2:Model runat="server" IDProperty="ID">
<ext2:ModelField Name="ID"></ext2:ModelField>
<ext2:ModelField Name="LastPublished"></ext2:ModelField>
<ext2:ModelField Name="ChangeGuidance"></ext2:ModelField>
<ext2:Column ID="Column1" runat="server" DataIndex="ID" Hidden="true"></ext2:Column>
<ext2:DateColumn Flex="1" runat="server" text="Last Published" DataIndex="LastPublished" Format="M/d/yyyy HH:mm:ss A" ></ext2:DateColumn>
<ext2:Column runat="server" DataIndex="ChangeGuidance" Text="Change Guidance" Editable="true">


Apr 20, 2017, 12:10 AM
Hello @rmelancon!

I've just tried your example here, but I get the actual time without any shift.

Are you running the sample code from an IIS server, or from Visual Studio directly, with the bundled IIS Express?

To me, the behavior you described is the same as having the server in a given time zone, and using a client with another time zone to open the page. So the server returns a time value, and the client "shifts" that to the local time zone.

But if you are using VS's bundled IIS express and browsing on your own development machine, you should be getting the actual current date without any changes.

Do you get the same problem using different browsers, which one have you tested with?

This might help you diagnose it:
- Add SourceFormatting="true" to your resource manager (makes it easier to read the page)
- Run without debugging in VS
- When you open the page, open the browser's developer tools
- Open the page to see its contents (the loaded aspx file itself)
- Look for something like that:

proxy: {data:[{"ID":1,"LastPublished":"

Then check if the dates are provided at that point already shifted by four hours.

If they are already shifted at that point, code-behind's current date reads differently than your local system and that would mean either:
- simply the server time where code behind is expanded -- the web server -- is on a different time zone
- a setting on the website (Web.config, maybe) could be making server calls run on a different time zone

If the dates imprinted in the source code are the expected values, whereas the client side date is displayed with the shift of hours, then we should have the client browser making the change or providing Ext.NET information so that it thinks that it is supposed to adjust the time to another time zone.

It is hard to say anything as I can't reproduce this here, and my time zone is GMT-3, so I should be reproducing this if the problem were just being in a time zone different than GMT/UTC.

Anyway, hope this helps you, maybe more information you provide on reproducing the issue would allow us to reproduce and provide more elaborate feedback.

May 13, 2017, 12:45 AM
Hello @rmelancon!

It's been a while since we last replied this inquiry and yet no feedback from you. Do you still need help with this? Without a clue to reproduce the issue on our side it is hard to help troubleshoot it.

May 16, 2017, 1:46 PM
I had to add a setting to adjust in javascript. Some globalization thing that I can't remember now what it was... but it is fixed. Thanks.

May 16, 2017, 6:48 PM
Alright! Glad you could overcome the issue! Thanks for the feedback.

May 18, 2017, 6:46 PM
This is what I had to add to fix it:

Ext.Net.JSON.GlobalSettings.DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Local

May 18, 2017, 9:54 PM
Interesting, @rmelancon! Thanks for sharing the solution that worked for you!