title: 2 variables in a function getting the same date value
body: <p>having a small issue with my dates. I have a function which receives a date and is stored into a few variables. I set the passed in date to different dates on both variables, but when run, it's the same. Following is a snippet</p>
  
  <pre><code>function dateChange(dateInput){
  var prevWeek = dateInput; 
  var prevMonth = dateInput;
  prevWeek.setDate(prevWeek.getDate()-7);
  prevMonth.setDate(prevMonth.getDate()-30); 
  
   var $prev_month_link = $( '&lt;a&gt;' )
        .html( "month" )
        .click(function(event){
            //prevMonth = new Date();
            alert("click prevMonth: "+prevMonth);
          //dateChange( prevMonth ) 
          prevMonth = prevMonth.substring(3,5)+"/"+prevMonth.substring(0,2)+"/"+prevMonth.substring(6,10)
          var prevMonth2 = new Date(prevMonth);
          //alert("line 132, current2 is: "+prevMonth2);
          dateChange(prevMonth2);
          event.stopPropagation();
        })
        .addClass("prevMonth")
        .attr('data-name', prevMonth)
        .appendTo( $prev_container )
  
        var $prev_week_link = $( '&lt;a&gt;' )
        .html( "week" )
        .click(function(event){
            alert("click prevWeek: "+prevWeek);
          prevWeek = prevWeek.substring(3,5)+"/"+prevWeek.substring(0,2)+"/"+prevWeek.substring(6,10)
          var prevWeek2 = new Date(prevWeek);
          dateChange( prevWeek2 ) 
          event.stopPropagation();
        })
        .addClass("prevWeek")
        .attr('data-name', prevWeek)
        .appendTo( $prev_container )
  }
  </code></pre>
  
  <p>My problem is prevWeek and prevMonth have the same date, even though I set them differently. I'm not sure if it's because of the click event taking place.
  example you can see here <a href="http://www.ccy.com.au/availability/" rel="nofollow">http://www.ccy.com.au/availability/</a></p>
  
  <p>Thank you in advance</p>