Why does Chrome Dev Tool show a dates __proto__ as Invalid Date?

“I’m still curious as to what it means when it says Invalid Date”

That’s simply the toString value of the prototype object of the Date constructor function.


Date.prototype.toString(); // "Invalid Date"

You can override it if you like…

Date.prototype.toString = function() { return "I like turtles." };

var myDate = new Date(1331869050000);
myDate.__proto__; // I like turtles.

A little off topic, but __proto__ is in the current working draft for the next version of ECMAScript, codename Harmony.

http://wiki.ecmascript.org/doku.php?id=harmony:specification_drafts

  • Added section B.3.1 with specifies __proto__ feature.

Leave a Comment