title: Is there a way to Object.freeze() a JavaScript Date?
body: <p>According to <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze" rel="noreferrer">MDN <code>Object.freeze()</code> documentation</a>:</p>
  
  <blockquote>
    <p>The <strong><code>Object.freeze()</code></strong> method freezes an object: that is, prevents new properties from being added to it; prevents existing properties from being removed; and prevents existing properties, or their enumerability, configurability, or writability, from being changed. In essence the object is made effectively immutable. The method returns the object being frozen.</p>
  </blockquote>
  
  <p>I was expecting that calling freeze on a date would prevent changes to that date, but it does not appear to be working.  Here's what I am doing (running Node.js v5.3.0):</p>
  
  <pre><code>let d = new Date()
  Object.freeze(d)
  d.setTime(0)
  console.log(d) // Wed Dec 31 1969 16:00:00 GMT-0800 (PST)
  </code></pre>
  
  <p>I would have expected the call to <code>setTime</code> to either fail or do nothing. Any ideas how to freeze a date?</p>