PDA

View Full Version : M$ Ajax Date serialization parser not working



IvanJ
12 May 2011, 1:23 PM
I could swear it used to work.

Try something like this in FF:

Ext.util.Format.date("\/Date(1238606590509+0800)\/","M$")

...this date is taken straight from the format examples. Outcome:

"\/Date(NaN)\/"

...please advise!

friend
13 May 2011, 10:07 AM
This:


Ext.util.Format.date(new Date(), 'M$') ;

Produces something akin to this:


"\/Date(1305309950863)\/"

Is that what you're thinking about?

IvanJ
13 May 2011, 11:07 AM
Hmm..

what I was actually trying to do was use an XTemplate and properly show a date that comes from AJAX in M$ serialized format. Now I'm thinking I got the logic backwards.

In my template, I had:

<p>{myAJAXDate:date("M$")}<p>

...now that I think about it - this action will expect myAJAXDate to contain a valid date, and it would simply try to format it.

Now that I try something like "Date.parseDate("\/Date(1305309950863)\/","M$")" - it work properly.

How would I utilize parseDate in a case of a template? Would I basically have to make sure that I have a valid date prior to running the template?

Thanks for showing my the error of my ways!