Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    9
    Vote Rating
    0
    rliota is on a distinguished road

      0  

    Default Date formatting is broken (4.1.1)

    Date formatting is broken (4.1.1)


    Ext version tested:
    • Ext 4.1.1

    Browser versions tested against:
    • Chrome

    Description:
    ExtJS's date formatter appears to be broken: 'time', 'timestamp', and 'u' all return invalid values. ('time' and 'timestamp' produce an - incomprehensible - alphanumeric string, and 'u' seems to produce "000" reliably.

    Steps to reproduce the problem:
    • Get a submit value from a datefield with submitFormat specified. (datefield.getSubmitValue())

    The result that was expected:
    A valid time, timestamp, or millisecond representation of the date.

    The result that occurs instead:
    An invalid time, timestamp, or millisecond representation of the date.

    Test Case:
    Code:
        Ext.onReady(function(){        
            timeStampDateField = Ext.create('Ext.form.field.Date',{
                fieldLabel:'\"timestamp\" formatter is broken',
                labelAlign:'right',
                renderTo:Ext.getBody(),
                labelWidth:150,
                margin:'0 0 10 0',
                submitFormat:'timestamp',
                listeners:{
                    change:function(me){
                        alert("timestamp: "+me.getSubmitValue())
                    }
                },
                minValue:new Date()
            });
            
            
            timeDateField = Ext.create('Ext.form.field.Date',{
                fieldLabel:'and so is \"time\"',
                labelAlign:'right',
                renderTo:Ext.getBody(),
                labelWidth:150,
                margin:'0 0 10 0',
                submitFormat:'time',
                listeners:{
                    change:function(me){
                        alert("time: "+me.getSubmitValue())
                    }
                },
                minValue:new Date()
            });
            
            timeDateField = Ext.create('Ext.form.field.Date',{
                fieldLabel:'and \"u\"',
                labelAlign:'right',
                renderTo:Ext.getBody(),
                labelWidth:150,
                margin:'0 0 10 0',
                submitFormat:'u',
                listeners:{
                    change:function(me){
                        alert("u: "+me.getSubmitValue())
                    }
                },
                minValue:new Date()
            });
            
        });

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


    This isn't a bug. 'time' & 'timestamp' are not valid Date formats: http://docs.sencha.com/ext-js/4-1/#!/api/Ext.Date

    'u' is
    Decimal fraction of a second
    , which is why you get 000. You want 'U'.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    9
    Vote Rating
    0
    rliota is on a distinguished road

      0  

    Default


    Oh - they used to work: (see http://docs.sencha.com/ext-js/4-1/#!...cfg-dateFormat)

    I had thought those were just partially documented standards. Is there an option for milliseconds? Or do I need to multiply seconds by 1000 everywhere we use date objects?
    Last edited by rliota; 10 Sep 2012 at 7:01 AM. Reason: information added

  4. #4
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    9
    Vote Rating
    0
    rliota is on a distinguished road

      0  

    Default


    Well because millisecond formatting is apparently gone, may I request some form of it gets put back in?
    I even wrote the code for you guys:

    http://www.sencha.com/forum/showthre...l=1#post885602

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


    I suppose we could add it, but I don't recall "time" or "timestamp".

    In fact I just checked in 3.x and 2.x, Ext.Date never had "time" or "timestamp" formatters, so perhaps you had some custom code that added them.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  6. #6
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    9
    Vote Rating
    0
    rliota is on a distinguished road

      0  

    Default


    Thanks for your reply!

    Hmm - I was using them in my model. (not directly in a date picker - which was just the easiest way to demonstrate this.)

    Is it possible the model's dateFormat configuration was using more than Ext.Date at one point? I know there are vestiges of the dateFormat config taking "time" and "timestamp" on the Ext.data.Field class according to the docs.

  7. #7
    Sencha User b0c1's Avatar
    Join Date
    Oct 2007
    Posts
    6
    Vote Rating
    0
    b0c1 is on a distinguished road

      0  

    Default I can reproduce...

    I can reproduce...


    Hi!

    I can reproduce the problem.
    I set dateFormat in the model to "time", and the server send a millisecond.
    It's work correctily, but if I want to save this field the date format generate: '313710e' string
    I thin it's parse the text char-by-char...

    t - days in month (oct have 31)
    i - minutes with leading zero (37)
    m - month with leading zero (10)
    e - 'e' becuase it's not parsed...
    b0c1

Thread Participants: 2

Tags for this Thread