PDA

View Full Version : [FIXED][3.0 CORE] Ext.isDate



stevemc
10 Apr 2009, 10:38 AM
Hi there

It looks like Ext.isDate() has dropped off Ext Core 3.0

I downloaded it today and Ext.util.JSON still looks like its missing.

Thanks for the great work anyway.

evant
10 Apr 2009, 11:48 PM
Yes, it's been dropped, so has all the other date methods.

JSON has been added to the build script, it will be in the next release.

OutpostMM
27 Apr 2009, 9:42 AM
What is the fix for Ext.encode since Ext.isDate is undefined? Ext.encode is defined like this in JSON.js for Ext Core 3.0 beta 1:


this.encode = function(o){
if(typeof o == "undefined" || o === null){
return "null";
}else if(Ext.isArray(o)){
return encodeArray(o);
}else if(Ext.isDate(o)){
return Ext.util.JSON.encodeDate(o);
...

Obviously that's an error since Ext.isDate is undefined, but what's the fix? Should that line be removed or replaced with other code, or is there a definition of Ext.isDate to use for Ext Core? The Ext.util.JSON.encodeDate function does exist, so I'm assuming there might be another way of testing if the variable is a date object. Is there another definition of isDate to use? e.g.:


function isDate(o)
{
return (((typeof o) == "object") && ((typeof o.toUTCString) == "function"));
}

mystix
27 Apr 2009, 6:03 PM
you could do a simple comparison like so:


} else if (Object.prototype.toString.apply(o) === '[object Date]' /* Ext.isDate(o) */) {

(which is what the Ext.isDate() method does)

TommyMaintz
1 May 2009, 8:12 PM
Fixed the JSON date encoding in SVN