Status: New
Owner: ----

New issue 1945 by [email protected]: call SetTime(0,0,0,0) and throws "this is not a Date object." if Date() object has been subclassed
http://code.google.com/p/v8/issues/detail?id=1945

I am seeing this error being thrown:
Uncaught TypeError: this is not a Date object.

In build:
userAgent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.46 Safari/535.11

This happens when I am executing this line in Javascript

var theDate = new window.top.Date();
theDate.setHours(0, 0, 0, 0);

I have added a few functions to the date object like this

Date.prototype.MakeisoZDateString = function() {
};

And what I believe is happening in the V8 code is that there is a check
IsDate()
which is checking if the object is explicitly of type Date - however, I believe by my adding the functions to the Date object, the type is no longer explicitly Date?

The fix should really be to see if the object is of type Date or has been derived from Date object.

thanks,

Scott.

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to