title: Extend javascript native object
body: <p>Hello I'm wondering how to extends a constructor like Date,
  The thing is I have a large, very large application and I want to know each time a Date object is instanciated. Basically I want to print something in the constructor. I don't want to define a new construtor in which I would call Date() and then replace Date by the new constructor all over the code.
  I really want to extend Date. And I came up with this:</p>
  
  <pre><code>var previousPrototype = Date.prototype;
  Date = function() {
   previousPrototype.constructor.call(this);
   console.log('new Date instanciation');
   }
  Date.prototype = previousPrototype;
  
  var extendedDate = new Date(); // prints 'new Date instanciation'
  </code></pre>
  
  <p>that seems good, but when I do <code>extendedDate.getTime()</code> for instance I get that sweet message </p>
  
  <pre><code>VM103:1 Uncaught TypeError: this is not a Date object.
  </code></pre>
  
  <p>I don't understand why it's not working, any help will be appreciated</p>