Datetime parsing in chrome

  1. #1

    Datetime parsing in chrome

    Hello
    I guess this is more feature then a bug... but still

    Basically - when Datetime from direct method is parsed to the store, it returns different value then when parsed


    Following example illustrate the problem ( in FF dates in grid and display field are same, in chrome not)

    Is there any logical explanation behind?

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    
    <script runat="server">
    	
    	[DirectMethod]
    	public static object[] GetData()
    	{
    		return new object[]
                {
                    new  { lastChange = new DateTime(2014,1,30,18,35,1)},
                  
                };
    	}
    
    </script>
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>Simple Array Grid - Ext.NET Examples</title>
        
    	
    </head>
    <body>
        <ext:ResourceManager ID="ResourceManager1" runat="server"  Theme="Gray" />
        
        <h1>Simple Array Grid</h1>
        <ext:DisplayField runat="server" ID="lblDate"></ext:DisplayField>
        <ext:GridPanel 
            ID="GridPanel1"
            runat="server" 
            Title="Array Grid" 
            Width="600" 
            Height="350">
            <Store>
                <ext:Store ID="Store1" runat="server">
                    <Model>
                        <ext:Model runat="server">
                            <Fields>
                               
                                <ext:ModelField Name="lastChange" Type="Date"   />
                            </Fields>
                        </ext:Model>
                    </Model>
                </ext:Store>
            </Store>
            <ColumnModel>
                <Columns>
                  
                    <ext:DateColumn runat="server" Text="Last Updated" DataIndex="lastChange" Format="Y-m-d h:i"  Flex="1"/>
                </Columns>            
            </ColumnModel>       
        </ext:GridPanel>
    <script>
    		Ext.onReady(function() {
    			var grid = <%=GridPanel1.ClientID %>;
    			var lblDate = <%= lblDate.ClientID %>;
    			var store = grid.store;
    			
    			App.direct.GetData({
    				complete:function(result, data) {
    					
    					for (var i = 0; i < data.length; i++) {
    						store.add(data[i]);
    
    						
    					}
    					var firstDate = new Date(data[0].lastChange);
    					lblDate.setValue(Ext.Date.format(firstDate, 'F j, Y, g:i a'));
    				}
    			})
    		})
    	</script>
      
        
    </body>
    </html>
  2. #2
    Actually I probably found the answer myself

    store uses Ext.Date.parse(...,'c') , where 'c' identifier does the trick - means it returns the same date in all major browsers
    probably better idea to use it rather then new Date() constructor

Similar Threads

  1. Store Reader DateTime Parsing w/ milliseconds
    By Thinjon100 in forum 1.x Help
    Replies: 2
    Last Post: Nov 20, 2013, 10:03 AM
  2. [CLOSED] Deserilization Parsing Error with Double Quotes
    By vzx in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Jun 19, 2013, 6:21 PM
  3. [FIXED] DirectEvent response xml parsing
    By r_honey in forum Bugs
    Replies: 2
    Last Post: May 07, 2011, 9:24 AM
  4. [CLOSED] IE8: HTML Parsing Error
    By jsdeveloper in forum 1.x Legacy Premium Help
    Replies: 21
    Last Post: Feb 22, 2011, 1:36 PM
  5. [CLOSED] [1.0] Json Webservice DateTime Parsing Error
    By webclouder in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Jun 04, 2010, 1:10 AM

Posting Permissions