Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Ext JS Premium Member htammen's Avatar
    Join Date
    Jul 2010
    Location
    Germany, Hannover
    Posts
    74
    Vote Rating
    0
    htammen is on a distinguished road

      0  

    Default [FIXED]DateField parsing/formatting problem

    [FIXED]DateField parsing/formatting problem


    I have the following DateField in a form
    PHP Code:
        xtype'datefield',
        
    fieldLabel'Datum',
        
    name'date',
        
    boxMaxWidth120,
        
    format'd.m.Y',
        
    altFormats'c' 
    The date comes from the server like this: date: "2009-12-13T23:00:00Z"
    Because I´m located in Germany (GMT+0100) I would expect to see the date "14.12.2009" but the datefield displays "13.12.2009".

    I assume that the datefield does not correctly parse/format the date according to my timezone.

    Beside the form which shows one record I list all records from backend in a gridpanel. Here the date is displayed like expected.
    PHP Code:
        {
          
    xtype'dateheader',
            
    text'Datum',
            
    dataIndex'date',
            
    format'd.m.Y H:i:s Z',
            
    flex1
        
    }, 

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,660
    Vote Rating
    584
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    You specify the format as d.m.Y, which means that's how it will get parsed. The TZ information is ignored.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Ext JS Premium Member htammen's Avatar
    Join Date
    Jul 2010
    Location
    Germany, Hannover
    Posts
    74
    Vote Rating
    0
    htammen is on a distinguished road

      0  

    Default


    as I understood the docu the datefield first tries to parse the date according to the pattern of the format property. If this does not return a valid date it takes all of the altFormats patterns.
    Here I defined 'c' which is fulfilled by the date sent from the backend.
    If I set altFormats in my example to 'd.m.Y' the date can't be parsed and the datefield is empty.

  4. #4
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,660
    Vote Rating
    584
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Duh, sorry I misread. Yeah I think you're right, I recall a fix going in for 3.x related to this.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  5. #5
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,660
    Vote Rating
    584
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Ok, I've added a fix. Not sure which release it will go into quite yet, but when I run the code it parses as the 14th.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  6. #6
    Ext JS Premium Member htammen's Avatar
    Join Date
    Jul 2010
    Location
    Germany, Hannover
    Posts
    74
    Vote Rating
    0
    htammen is on a distinguished road

      0  

    Default


    Thanks a lot.

Similar Threads

  1. Replies: 11
    Last Post: 18 Oct 2009, 8:49 AM
  2. Ext.form.DateField - formatting ignored?
    By fruitwerks in forum Ext 3.x: Help & Discussion
    Replies: 11
    Last Post: 15 Aug 2009, 11:22 AM
  3. <SOLVED> Parsing Arraydata into DateField
    By wvmaaren in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 10 Jul 2009, 3:25 AM
  4. Datefield Auto Formatting
    By twilsonxpert in forum Ext 2.x: Help & Discussion
    Replies: 11
    Last Post: 12 May 2008, 7:52 AM
  5. [SOLVED] dateField formatting problem
    By catacaustic in forum Ext 1.x: Help & Discussion
    Replies: 3
    Last Post: 9 Aug 2007, 3:28 PM

Thread Participants: 1