Results 1 to 10 of 10

Thread: Dates coming as NaN on Safari only

  1. #1
    Ext JS Premium Member
    Join Date
    Nov 2009
    Location
    San Diego, CA
    Posts
    158
    Vote Rating
    0
      0  

    Default 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 nice date. This works fine for Chrome but in Safari they come across as "NaN-NaN-NaN".

    Do I need to do something special for Safari?

    Here's the code for the transform:
    Code:
        <textarea class="x-hidden-display" id="dieinfo-dates">
            <h4>{dieName}</h4>
            <p>ES (Baseline): {baselineESDate:date("Y-m-d")}</p>
            <p>ES (Latest): {latestESDate:date("Y-m-d")}</p>
        </textarea>
    In JSON, they'll look like this:
    "latestESDate":"2029-01-31 00:00:00.0"

  2. #2
    Sencha User
    Join Date
    Aug 2010
    Location
    Europa
    Posts
    216
    Vote Rating
    1
      0  

    Default

    I have the same problem. Has anyone found a solution yet?

  3. #3
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    18,752
    Vote Rating
    896
      0  

    Default

    It's a bug in Safari. You should pass a format as specified here: http://dev.sencha.com/deploy/touch/docs/?class=Date

    So it will use the Touch parser instead.
    Evan Trimboli
    Twitter - @evantrimboli

  4. #4
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Redwood City
    Posts
    30,626
    Vote Rating
    56
      0  

    Default

    You should explicitly convert that string to a Date.
    Longtime Sencha geek. Outspoken advocate of pure Javascript Views. Posts my own opinions.

  5. #5
    Sencha User
    Join Date
    Aug 2010
    Location
    Europa
    Posts
    216
    Vote Rating
    1
      0  

    Default

    Quote Originally Posted by Animal View Post
    You should explicitly convert that string to a Date.
    What do you mean?

  6. #6
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Redwood City
    Posts
    30,626
    Vote Rating
    56
      0  

    Default

    It's a string isn't it? It's "2029-01-31 00:00:00.0"

    You need to convert that to a Date object using http://dev.sencha.com/deploy/touch/d...mber=parseDate

    Ext.util.Format.Date attempts to use the Date object's default conversion to create a Date object if you pass a string. But it appears that the Date object's default string conversion differs between browsers.

    So you will have to convert it.
    Longtime Sencha geek. Outspoken advocate of pure Javascript Views. Posts my own opinions.

  7. #7
    Sencha User
    Join Date
    Aug 2010
    Location
    Europa
    Posts
    216
    Vote Rating
    1
      0  

    Default

    Thanks

    (sometimes I really hate Apple)

  8. #8
    Sencha User
    Join Date
    Aug 2010
    Location
    Europa
    Posts
    216
    Vote Rating
    1
      0  

    Default

    Thanks, I have fixed it.

    (sometimes I really hate Apple)

  9. #9
    Sencha User
    Join Date
    Aug 2012
    Posts
    92
    Vote Rating
    0
      0  

    Default

    Is this also an issue in extjs 4? How/where would you reccomend converting the dates to date-type in MVC format? My model says the type is date, do I still have to convert them?

    Thank you for any help!

  10. #10
    Sencha User
    Join Date
    Aug 2012
    Posts
    92
    Vote Rating
    0
      0  

    Default

    nevermind, figured it out

Similar Threads

  1. 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
  2. Storing dates in grid panel as Excel-dates
    By dan007 in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 2 Dec 2009, 11:02 PM
  3. [FIXED][2.x] Ext.num(NaN, 0) returns NaN
    By mystix in forum Ext 2.x: Bugs
    Replies: 8
    Last Post: 14 Mar 2009, 7:06 PM
  4. [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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •