title: Why aren't the references to the private var's not being updated?
body: <p>The add method isn't working like intended. When I have 2 time object t (all 0's), and t2 (1 minute). When I add t2 to t, t doesn't change BUT when I call my toString method on t it gives me the expected value. Here is what I mean if that makes no sense: <a href="http://i.imgur.com/1VSdgw1.jpg" rel="nofollow">An example of what I mean</a>!</p>
  
  <p>What I think the problem is t's global references aren't being updated after the call to add. I just can't understand why.</p>
  
  <p>I would like to know why it isn't working not just how to fix the problem.</p>
  
  <pre><code>Time = function(pyear, pmonth, pdate, phour, pminute, psecond)
  {
      var that = this;
      that.year = 0;
      that.month = 0;
      that.date = 0;
      that.hour = 0;
      that.minute = 0;
      that.second= 0;
  
      //constructor
      if(pyear !== undefined)
      {
          that.year = pyear;
          that.month = pmonth;
          that.date = pdate;
          that.hour = phour;
          that.minute = pminute;
          that.second = psecond;
      }
  
      //adds toAdd time object to time
      function add(toAdd)
      {
          that.year += toAdd.year;
          that.month += toAdd.month;
          that.date += toAdd.date;
          that.hour += toAdd.hour;
          that.minute += toAdd.minute;
          that.second += toAdd.second;
      }
  
  
  
      //returns time as a String
      function toString()
      {
          var toReturn = "";
          if(that.year &lt; 1000)
          {
              if(that.year &lt; 100)
              {
                  if(that.year &lt; 10)
                  {
                      toReturn += "0";
                  }
                  toReturn += "0";
              }
              toReturn += "0";
          }
  
          toReturn += that.year + "-";
  
          if(that.month &lt; 10)
          {
              toReturn += "0";
          }
  
          toReturn += that.month +"-";
  
          if(that.date &lt; 10)
          {
              toReturn += "0";
          }
  
          toReturn += that.date +"T";
  
          if(that.minute &lt; 10)
          {
              toReturn += "0";
          }
  
          toReturn += that.minute +":";
  
          if(that.second &lt; 10)
          {
              toReturn += "0";
          }
  
          toReturn += that.second;
          //year +"-"+ month +"-"+ date +"T"+ hour +":"+ minute +":"+ second
          return toReturn;
      }
  
      return{
          year: that.year,
          month: that.month,
          date: that.date,
          hour: that.hour,
          minute: that.minute,
          second: that.second,
          add: add,
          toString: toString
      }
  };
  </code></pre>