Success! Looks like we've fixed this one. According to our records the fix was applied for a bug in our system in a recent build.
  1. #1
    Ext Premium Member Jan (HL)'s Avatar
    Join Date
    Aug 2010
    Location
    Germany
    Posts
    111
    Vote Rating
    9
    Jan (HL) will become famous soon enough

      0  

    Default [4.1.2] DateFormat (ISO) does not parse correctly?

    [4.1.2] DateFormat (ISO) does not parse correctly?


    Hi,

    I'm just going into some trouble after we'd deployed/tested the application (with Ext JS 4) on a server not in the same time zone than the clients.

    Originally, the date/timestamps are served in the ISO format with timezone:
    PHP Code:
    // Property of record serverside
    datetime "2012-10-18T16:17:51.299+0200" 
    Since Ext JS 3, we've used the model type "date" + dateFormat "c". If I'm correct this dateFormat wont be supported??
    Removing the dateFormat (only type "date") works in Chrome/Firefox perfectly (because of internal JS' Date usage), but not in IE (NaN/empty grids).

    Because of this issues, I've revisited the doc.. and there are some examples.

    I changed the timezone of my VM to Hawaii and use a my-local timezone (Germany).

    Using the library with a example string right of the documentation:
    Ext.Date.parse("1997-05-16T19:23:30.12345+02:00", "c").toString()

    should not be
    Fri May 16 1997 19:23:30 GMT-1000 (Hawaii Normalzeit)

    but should be
    Fri May 16 1997 07:23:30 GMT-1000 (Hawaii Normalzeit).

    In Chrome (native)
    new Date("1997-05-16T19:23:30.12345+02:00")

    is okay. In IE, this is NaN.


    edit: Anyway, I've open a ticket.

    You break down the whole issue with following one-liner:
    Ext.Date.parse("2012-10-18T16:17:51.299+0000", "c")


    This date should be the 18th Oct 2012, 16h17m51s (UTC) because timezone 0.


    In my case, the local timezone is +0200. So, when using the line above in Ext JS 4.1.1
    Thu Oct 18 2012 16:17:51 GMT+0200 (CEST)


    But in Ext JS 4.1.2
    Thu Oct 18 2012 18:17:51 GMT+0200 (CEST)




    I tried it again, the same expression with the timezone Hawaii set up in the operating system.
    In Ext JS 4.1.1
    Thu Oct 18 2012 06:17:51 GMT-1000 (Hawaii Normalzeit)


    But in Ext JS 4.1.2
    Thu Oct 18 2012 16:17:51 GMT-1000 (Hawaii Normalzeit)

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,647
    Vote Rating
    583
    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


    If I run:

    Ext 3
    Code:
    var s = Date.parseDate('2012-10-18T16:17:51.299+0000', 'c');
    console.log(s);
    Ext 4
    Code:
    var s = Ext.Date.parse('2012-10-18T16:17:51.299+0000', 'c');
    console.log(s);
    Tried against (with Chrome):
    3.4.0
    4.0.2a
    4.1.1
    4.1.2

    It all gives me the same result :

    Code:
    Fri Oct 19 2012 03:17:51 GMT+1100 (AUS Eastern Daylight Time)
    Perhaps something else is going on, because this hasn't changed in a while.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Ext Premium Member Jan (HL)'s Avatar
    Join Date
    Aug 2010
    Location
    Germany
    Posts
    111
    Vote Rating
    9
    Jan (HL) will become famous soon enough

      0  

    Default


    I'am replaying your stuff again on Chrome22Firefox14, WinXP, TZ+11.

    PHP Code:
    console.infoExt.Date.parse('2012-10-18T16:17:51.299+0000''c') )
    Thu Oct 18 2012 16:17:51 GMT+1100 (Wladiwostok Normalzeit)
    console.info (Ext.getVersion().toString() )
    4.1.2.1 
    The testcase is very simple..
    PHP Code:
    <!DOCTYPE html>
    <
    html>
        <
    head>
            <
    meta http-equiv="Content-type" content="text/html; charset=utf-8">        <title>Demo</title>
            <
    script src="../libs/ext-4.1.2a/ext-all-debug-w-comments.js"></script>
            <link rel="stylesheet" href="../libs/ext-4.1.2a/resources/css/ext-all.css" type="text/css" media="screen" title="no title" charset="utf-8">
        </head>
        <body>
        </body>
    </body></html> 

  4. #4
    Ext Premium Member Jan (HL)'s Avatar
    Join Date
    Aug 2010
    Location
    Germany
    Posts
    111
    Vote Rating
    9
    Jan (HL) will become famous soon enough

      0  

    Default


    Got it. Two typos in your code.

    In your Ext.Date.Parser for dateFormat "c", there are two if statements: One with "if (W)" and one with if (O). Both of them are wrong.

    "if (W)" is actually completely unused (W will be never written).

    "if (O)" should be "if (o)".

  5. #5
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,647
    Vote Rating
    583
    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


    Could you elaborate a bit please?
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  6. #6
    Ext Premium Member Jan (HL)'s Avatar
    Join Date
    Aug 2010
    Location
    Germany
    Posts
    111
    Vote Rating
    9
    Jan (HL) will become famous soon enough

      0  

    Default


    Left 4.1.2a -- right 4.1.2a +Patch.

    You will find this in Date.js at line 235.
    The same lines are present in 4.1.1, but with a small "o".

    The only one step where the timezone will be applied is in these lines

    Code:
                // favor UTC offset over GMT offset
                "if(zz != null){",
                    // reset to UTC, then add offset
                    "v = me.add(v, me.SECOND, -v.getTimezoneOffset() * 60 - zz);",
                "}else if(O){",
                    // reset to GMT, then add offset
                    "v = me.add(v, me.MINUTE, -v.getTimezoneOffset() + (sn == '+'? -1 : 1) * (hr * 60 + mn));",
                "}",
    The red O was never be written, but o.

    Bildschirmfoto 2012-10-19 um 13.11.34.jpg

    edit: My local Git diff
    Code:
    diff --git a/src/main/webapp/resources/ext-4.1.2/src/core/src/lang/Date.js b/src/main/webapp/resources/ext-4.1.2/src/core/src/lang/Date.js
    index 586e9c6..6c4d4cb 100755
    --- a/src/main/webapp/resources/ext-4.1.2/src/core/src/lang/Date.js
    +++ b/src/main/webapp/resources/ext-4.1.2/src/core/src/lang/Date.js
    @@ -232,7 +232,7 @@ Ext.Date = new function() {
                 "if(zz != null){",
                     // reset to UTC, then add offset
                     "v = me.add(v, me.SECOND, -v.getTimezoneOffset() * 60 - zz);",
    -            "}else if(O){",
    +            "}else if(o){",
                     // reset to GMT, then add offset
                     "v = me.add(v, me.MINUTE, -v.getTimezoneOffset() + (sn == '+'? -1 : 1) * (hr * 60 + mn));",
                 "}",

  7. #7
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,647
    Vote Rating
    583
    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'm with you. I got a little confused because this one is already fixed, the current source is the same as what you've got there. Will be part of the next release.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

Thread Participants: 1