View Full Version : Dates coming as NaN on Safari only

5 Aug 2010, 4:46 PM
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:

<textarea class="x-hidden-display" id="dieinfo-dates">
<p>ES (Baseline): {baselineESDate:date("Y-m-d")}</p>
<p>ES (Latest): {latestESDate:date("Y-m-d")}</p>

In JSON, they'll look like this:
"latestESDate":"2029-01-31 00:00:00.0"

7 Oct 2010, 10:50 PM
I have the same problem. Has anyone found a solution yet?

7 Oct 2010, 10:55 PM
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.

7 Oct 2010, 11:17 PM
You should explicitly convert that string to a Date.

7 Oct 2010, 11:20 PM
You should explicitly convert that string to a Date.
What do you mean?

7 Oct 2010, 11:25 PM
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/docs/?class=Date&member=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.

8 Oct 2010, 4:32 AM

(sometimes I really hate Apple)

8 Oct 2010, 4:33 AM
Thanks, I have fixed it.

(sometimes I really hate Apple)

28 Jan 2013, 3:27 PM
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!

28 Jan 2013, 4:49 PM
nevermind, figured it out