Ext.Net.DateColumn Format issue

  1. #1

    Ext.Net.DateColumn Format issue

    Danil posted that the Format property of the DateColumn should use the .NET date format located here: http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx

    However, I found that using lower case m "m" or "mm" uses the month instead of the minute as specified in the .NET specification. Using "n" or "nn" does work however...just thought i'd document that as a bug to help anyone that might run into the same problem.
  2. #2
    Hi,

    "mm" appears to be working fine for me.

    But, really, there is a problem with "m". According to .NET specifiers "m" is "the minute, from 0 through 59."

    However, there is no such format in ExtJS (PHP), there is only the minute with leading zeros, i.e. from 00 to 59.

    Therefore the Format="m" is just not converted and stayed "m" on client side, which means the month with leading zeros.

    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 },
                    new object[] { DateTime.Now.AddMinutes(1) },
                    new object[] { DateTime.Now.AddMinutes(2) }
                };
                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>
        <form runat="server">
            <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:DateColumn Header="Month" DataIndex="test" Format="m" />
                        <ext:DateColumn Header="Minutes" DataIndex="test" Format="mm" />
                    </Columns>
                </ColumnModel>
            </ext:GridPanel>
        </form>
    </body>
    </html>
    See also
    http://docs.sencha.com/ext-js/3-4/#!/api/Date

    Please clarify do you mean .NET specifiers here or ExtJS (PHP)?
    Using "n" or "nn" does work however
  3. #3

    OOPS - My Mistake - you are right!

    I must have been getting confused with the PHP vs. .NET - i knew that "m" wasn't working, and i thought i tried "n" and it worked, but i must have been looking at something else....to be clear "mm" is the ONLY format you can use for minutes. i.e.:

                                            
         Ext.Net.DateColumn c = new Ext.Net.DateColumn();
         c.Format = "M/d/yyyy h:mm A";
    "n" and "nn" are the PHP codes for month i.e.:

         rdr.Fields.Add(colName, Ext.Net.RecordFieldType.Date, "n/j/Y g:i:s A");
    Sorry Danil!
  4. #4
    No problem! Thanks for pointing us to a possible bug. We are always happy to make our toolkit better.
  5. #5

    Date Column Format issue in IE

    Hi I am using Ex.net Grid control. Date Column is displaying with Not a number issue (NANANAN) whereas it is working fine with Google chrome and Mozilla firefox.Pls help me to resolve.

Similar Threads

  1. Replies: 1
    Last Post: Nov 29, 2011, 5:11 PM
  2. [CLOSED] DateColumn with Format="HH:mm:ss"
    By digitek in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Nov 25, 2011, 11:15 AM
  3. Replies: 3
    Last Post: Nov 01, 2011, 6:15 PM
  4. [CLOSED] Date Format in DateColumn Elements
    By ljcorreia in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jun 28, 2011, 8:12 AM
  5. [CLOSED] DateColumn, Format
    By jeybonnet in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Dec 03, 2010, 1:57 PM

Tags for this Thread

Posting Permissions