I have a JSON object that can (is) storing a Date (and/or any other JS object) but I'm not sure how to get it out once it's in it. For example I have this sample code, but it's not working:
for(var key in value){
    if(value.hasOwnProperty(key)){
        if(typeof value[key] == 'object'){
            if(value[key].Date){
                console.log('this is a date')
            }
            else{
                console.log('not a date');
            }
        }
    }
}
However, it just keeps return not a date. If i inspect the JSON object with Firebug or the Developer Console in WebKit i see __proto__: Date inside of the corresponding JSON item... so, how do I get it out or check for it?
--EDIT--
Here is what i see in the debugger:
Object
->isADate: Fri Nov 26 2010 20:30:57 GMT-0800 (Pacific Standard Time)
--->__proto__: Date
->notADate: "some string"
--->__proto__: Object
And here is the JSON im creating:
var dateStorage = new storageLocker('date-test');
dateStorage.save({'isADate':new Date(),'notADate':'some string'});
Here is the code for this part of my script (http://github.com/oscargodson/storagelocker)
storageLocker.prototype.save = function(value){
var json = JSON.parse(localStorage.getItem(this.catalog));
if(json == null){json = {};}
for(var key in value){
    if(value.hasOwnProperty(key)){
        json[key] = value[key];
        console.log(value[key].Date);
        if(typeof value[key] == 'object'){
            if(value[key].Date){
                console.log('this is a date')
            }
            else{
                console.log('not a date');
            }
        }
    }
}
localStorage.setItem(this.catalog,JSON.stringify(json));
return this;
}
Thanks a lot! Hope this helps out more!
 
     
     
    