title: How to update expiration date of cookie via jQuery?
body: <p>I'd like to update the expiration date of a cookie via jQuery. I am using the <a href="https://github.com/carhartl/jquery-cookie/blob/master/jquery.cookie.js" rel="nofollow">jQuery cookie plugin</a>. </p>
  
  <p>Here is the code I used to set the expiration date to 8 hours into the future:</p>
  
  <pre><code>var date = new Date();
  date.setTime(date.getTime() + (8 * 60 * 60 * 1000));
  $.cookie('myCookie', $.cookie('myCookie'), { expires: date });
  </code></pre>
  
  <p>This created a new cookie with the right name, but the wrong attributes:</p>
  
  <ul>
  <li>The new cookie had the value <code>[object Object]</code> instead of the original, ampersand-delimited, key-value cookie string</li>
  <li>No SSL (secure) flag in the new cookie (old cookie had SSL flag set to true)</li>
  <li>Expiration was set to when the browser is quit, instead of 8 hours into the future</li>
  </ul>
  
  <p>What is a correct way to only update the expiration date of a cookie via jQuery?</p>