title: Strange behavior when getting total weeks of the month
body: <p>I have strange problem. I have to calculate total weeks of the given date month.</p>
  
  <p>My logic is working perfectly it will return me correct week number but the problem is my original date was also getting changed during calculating weeks.</p>
  
  <p>I have stored my original date in other variable and passed other variable to the function but still the original date is also getting changed. 
  <strong>How can i restrict change my original date?</strong> </p>
  
  <pre><code> var currentDate;
   $(document).ready(function () {
      currentDate = new Date();
   });
  function goNextMonth() {
     var dt = currentDate;
     console.log("Before Date: " + currentDate);
     var weeks = getWeeksOfMonth(dt);
     console.log("After Date: " + currentDate + ", Weeks: " + weeks);
  }
  function getWeeksOfMonth(date) {
      var firstDay = new Date(date.setDate(1)).getDay();
      var totalDays = new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();
      return Math.ceil((firstDay + totalDays) / 7);
  }
  </code></pre>
  
  <p>Cosole Log:
  <img src="https://i.stack.imgur.com/Stkin.png" alt="enter image description here"></p>
  
  <p>HTML code</p>
  
  <pre><code> &lt;input type="button" value="Next Month" onclick="goNextMonth()" /&gt;
  </code></pre>