[CLOSED] Wrong JSON Date Timezone ...

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] Wrong JSON Date Timezone ...

    Hi, Ext.NET always converts the JSON Date to GMT+0. For Example:

    JSON Response looks like this: {"Name":"xxx","Erstellt":"2012-05-11T11:45:23"}
    ... and Grid renders the date to: 13:45:23

    Our Timezone is GMT+2

    <ext:Column runat="server" Header="Erstellt" DataIndex="Erstellt">
        <Renderer Fn="Ext.util.Format.dateRenderer('d.m.Y H:i')" />
    </ext:Column>
    Last edited by Daniil; May 28, 2014 at 4:20 AM. Reason: [CLOSED]
  2. #2
    Hi,

    Please clarify how we can reproduce the problem? I mean this
    JSON Response looks like this: {"Name":"xxx","Erstellt":"2012-05-11T11:45:23"}
    ... and Grid renders the date to: 13:45:23
    One note - the grid should not show seconds at all according to the format "d.m.Y H:i". It should show only hours and minutes. Certainly, apart from year, month and day.

    I am unable to reproduce the problem using the example below.

    Example
    <%@ Page Language="C#" %>
     
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                Store store = this.GridPanel1.GetStore();
                store.DataSource = new object[] 
                { 
                    new object[] { DateTime.Now }
                };
                store.DataBind();
            }
        }
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.NET Example</title>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
        <ext:GridPanel ID="GridPanel1" runat="server" AutoHeight="true">
            <Store>
                <ext:Store runat="server">
                    <Reader>
                        <ext:ArrayReader>
                            <Fields>
                                <ext:RecordField Name="test" Type="Date" /> 
                            </Fields>
                        </ext:ArrayReader>
                    </Reader>
                </ext:Store>
            </Store>
            <ColumnModel runat="server">
                <Columns>
                    <ext:Column runat="server" Header="Date" DataIndex="test">
                        <Renderer Fn="Ext.util.Format.dateRenderer('d.m.Y H:i')" />
                    </ext:Column>
                </Columns>
            </ColumnModel>
        </ext:GridPanel>
    </body>
    </html>
    I see "2012-05-11T16:07:52.618" in the Page sources (a date is serialized with milliseconds in the latest Ext.NET sources).

    And there is "11.05.2012 16:07" in the GridPanel.

    Here is GMT+4 on my PC.
    Last edited by Daniil; May 11, 2012 at 12:19 PM.
  3. #3
    First, you are first who have such strange issue (in 4 years), i never seen any such date transformation.
    Do you have the same issue with online samples?
    What time do you see in this sample?
    https://examples1.ext.net/#/GridPane...rayWithPaging/

    Is it different with this server time (right time is server time)?
    https://examples1.ext.net/#/TaskManager/Basic/Overview/

    I have GMT+4 and i cannot reproduce the issue
    For example, I opened 'examples1.ext.net' in a browser (Chrome)
    And executed following script in the console
    -(new Date().getTimezoneOffset( ) / 60)
    It is client side timezone. For me, it equals 4

    Then
    var date = Date.parseDate("2012-05-11T11:45:23", "Y-m-dTh:i:s");Ext.util.Format.dateRenderer('d.m.Y H:i')(date)
    I see "11.05.2012 11:45", so i don't see any issue

    Much appreciate if you can provide more details
  4. #4
    Hi, no the Servertime is the same. I have the same problem with the v2 Infinite Scrolling Demo:
    https://examples2.ext.net/#/GridPane...ling/Overview/

    The JSON Data looks like this:
    [{"Company":"Company 301","Price":40,"LastUpdate":"2012-05-13T10:08:58"}

    But the rendering time is: 5/13/2012 12:08:58 PM

    hmmm??
  5. #5
    It works with the Ext:DateColumn with Format "dd.MM.yyyy HH:mm" and JsonReader RecordField Type "Date"...
    Seems to be a problem in the DateRenderer Function for standard Grid Columns??
  6. #6
    DateColumn is just commom column with dateRenderer
    Ext.grid.DateColumn = Ext.extend(Ext.grid.Column, {    format : 'm/d/Y',
        constructor: function(cfg){
            Ext.grid.DateColumn.superclass.constructor.call(this, cfg);
            this.renderer = Ext.util.Format.dateRenderer(this.format);
        }
    });
    Therefore I am doubt that your issue is related with it
    I am still unable to reproduce the issue and have no ideas what can cause it
  7. #7
    Hi @prointernet,

    Please clarify is the problem still actual? Can we mark the thread as closed?
  8. #8
    Hello, I know this is old, but have the same problem. I'm using versin 2.x and in a Grid Panel, I have this column
     <ext:DateColumn ID="Column6" runat="server" DataIndex="insertDate" Text="Inserted Date" Format="yyyy-MM-dd HH:mm" />
    and algo I've tried

    <ext:DateColumn ID="Column6" runat="server" DataIndex="insertDate" Text="Inserted Date" Format="y-M-d H:i" />
    In both cases, I have 3 hours of diference with the actual data. For example, in server I have 2012-07-10 21:10:37.207, but in view is rendered 2012-07-10 18:10

    Thanks in advance
    Last edited by Daniil; Jan 11, 2013 at 1:51 PM. Reason: Please use [CODE] tags
  9. #9
    Hi @nahuelsantos,

    Please provide a sample to reproduce.
  10. #10
    Quote Originally Posted by Daniil View Post
    Hi @nahuelsantos,

    Please provide a sample to reproduce.
    I got the same problem. Please test it in IE or Chrome. It works fine in Firefox.
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] Date Field - MVC/JSON
    By adelaney in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: Apr 30, 2012, 7:56 PM
  2. [CLOSED] Cancel button event if wrong date in datefield
    By nhg_itd in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Oct 11, 2011, 8:25 AM
  3. [CLOSED] Wrong Date Format on the store
    By ViDom in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 25, 2011, 9:56 PM
  4. Is there anything wrong with this JSON approach?
    By michaeld in forum 1.x Help
    Replies: 1
    Last Post: Sep 11, 2009, 12:23 PM
  5. [CLOSED] MVC Json and Date field type
    By mthird in forum 1.x Help
    Replies: 2
    Last Post: Oct 17, 2008, 6:05 AM

Posting Permissions