title: TypeError: date.getHours is not a function?
body: <p>I keep getting this error: </p>
  
  <blockquote>
    <p>TypeError: date.getHours is not a function</p>
  </blockquote>
  
  <p>when trying to use <code>.getHours</code> and I'm not sure why. This is the code I'm using:</p>
  
  <pre><code>import React from "react";
  import "../Nav/Nav.css";
  import Date from "./Date";
  
  function NavBar() {
    var date = new Date();
    var hrs = date.getHours();
    var greeting;
  
    if (hrs &lt; 12) greeting = "Good Morning";
    else if (hrs &gt;= 12 &amp;&amp; hrs &lt;= 17) greeting = "Good Afternoon";
    else if (hrs &gt;= 17 &amp;&amp; hrs &lt;= 24) greeting = "Good Evening";
  
    return (
      &lt;div className="nav-container"&gt;
          &lt;p className="greeting"&gt;{greeting}&lt;/p&gt;
          &lt;Date /&gt;
      &lt;/div&gt;
    );
  }
  
  export default NavBar;
  </code></pre>