Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Ext JS Premium Member
    Join Date
    Nov 2009
    Location
    San Diego, CA
    Posts
    158
    Vote Rating
    0
    locutusUT is on a distinguished road

      0  

    Default [CLOSED-205] Dates coming as NaN on Safari only

    [CLOSED-205] Dates coming as NaN on Safari only


    I have some dates that I'm posting that are being transformed from their raw JSON response to a pretty date. This works fine for Chrome but in Safari they come across as "NaN-NaN-NaN".

    Here's the code for the date transform and I have them specified as type "date" in the model (also tried string):

    Code:
        <textarea class="x-hidden-display" id="dieinfo-dates">
             <p>ES (Latest): {latestESDate:date("Y-m-d")}</p>
        </textarea>
    In JSON, dates come across like this:
    "latestESDate":"2029-01-31 00:00:00.0"

  2. #2
    Sencha User Jamie Avins's Avatar
    Join Date
    Mar 2007
    Location
    Redwood City, California
    Posts
    3,661
    Vote Rating
    20
    Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough

      0  

    Default


    What about the supported devices?

  3. #3
    Ext JS Premium Member
    Join Date
    Nov 2009
    Location
    San Diego, CA
    Posts
    158
    Vote Rating
    0
    locutusUT is on a distinguished road

      0  

    Default


    Yes, by Safari, I mean Safari that runs both on the desktop as well as iOS4.

  4. #4
    Sencha User Jamie Avins's Avatar
    Join Date
    Mar 2007
    Location
    Redwood City, California
    Posts
    3,661
    Vote Rating
    20
    Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough

      0  

    Default


    Perfect, that what I wanted to know.

  5. #5
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,833
    Vote Rating
    609
    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 wouldn't say it's a bug in Touch. Since you didn't specify a date format, it runs the value through the native browser Date.parse. It seems Chrome treats that as a valid date by default, but Safari doesn't.

    However, you can easily work around it by specifying the format:

    Code:
    Ext.setup({
        onReady: function(){
            console.log(Date.parse('2029-01-31 00:00:00.0'));
            
            Ext.regModel('Test', {
                fields: [{
                    name: 'dob',
                    type: 'date',
                    dateFormat: 'Y-m-d H:i:s.u'
                }]
            })
            
            var store = new Ext.data.Store({
                autoLoad: true,
                model: 'Test',
                proxy: {
                    type: 'ajax',
                    url: 'test.json',
                    reader: {
                        type: 'json',
                        root: 'data'
                    }
                },
                listeners: {
                    read: function(){
                        console.log(store.getAt(0).get('dob'));
                    }
                }
            });
        }
    });
    Where the underlying data is:

    Code:
    {
        "data": [{
            "dob": "2029-01-31 00:00:00.0"
        }]
    }
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  6. #6
    Ext JS Premium Member
    Join Date
    Nov 2009
    Location
    San Diego, CA
    Posts
    158
    Vote Rating
    0
    locutusUT is on a distinguished road

      0  

    Default


    No, that doesn't quite work either. As I pointed out in this post, the dates still come access as NaN even with adding the date format in the model.

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


    The above, on Safari 5 and my iPad shows the appropriate date in the read callback.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

Similar Threads

  1. Dates coming as NaN on Safari only
    By locutusUT in forum Sencha Touch 1.x: Discussion
    Replies: 9
    Last Post: 28 Jan 2013, 4:49 PM
  2. daterender in xgcolumnmodel problem NaN/NaN/NaN
    By DominateQ in forum Ext 2.x: Help & Discussion
    Replies: 19
    Last Post: 22 Apr 2010, 9:25 AM
  3. [SOLVED] Grid + DateTime Column + add new record = NaN-NaN-NaN
    By alaska in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 29 May 2008, 1:32 PM

Thread Participants: 2

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi