TimeShift-js
TimeShift-js copied to clipboard
toLocaleDateString doesn't work in V8 when we override Date
> Date = TimeShift.Date
> new TimeShift.Date().toLocaleDateString()
TypeError: Method invoked on an object that is not Date.
> new TimeShift.OriginalDate().toLocaleDateString()
TypeError: Method invoked on an object that is not Date.
It looks like V8 code checks if date instanceof Date (see overrides.js) which fails when Date has been changed.
That's strange - the code always invokes the original toLocaleDateString method on the original Date object. When I run those commands in Chromium version 28, they work (though may produce the wrong string, as stated in the known issues). What are you running those commands on?