title: How to set Google Tasks Due Date
body: <p>How do you set the due date for a task with the google tasks service in apps script?</p>
  
  <p><a href="https://developers.google.com/apps-script/advanced/tasks" rel="nofollow noreferrer">Tasks Service</a></p>
  
  <p>Trying to set this value to a given date, but this seems to only update the local value not the server value as tehhowch suggests</p>
  
  <pre><code>task.due = new Date();
  </code></pre>
  
  <p>How do you update the server? Here is what I tried</p>
  
  <pre><code>var x = {
      due: new Date()
  };
  Tasks.Tasks.update(x, "MDE2NzI3NTAzNjc5NTQ1ODY5MTY6MDow", task);
  </code></pre>
  
  <p>but it throws the error</p>
  
  <pre><code>Invalid value for: Invalid format: "Tue Apr 10 20:45:26 GMT-04:00 2018"
  </code></pre>
  
  <hr>
  
  <h2>Completed Project</h2>
  
  <p>I used this code to create this project for keeping Google Tasks up to date:</p>
  
  <p><a href="https://script.google.com/d/12zeQP7ujIqCPEiQi7CxF-1t5Z6z8JC5hdwbeA5syDtvuhNSZ44tEfd_5/edit?usp=sharing" rel="nofollow noreferrer">Keep Google Tasks Updated</a></p>
  
  <p><a href="https://github.com/CTOverton/Keep-Google-Tasks-Updated" rel="nofollow noreferrer">https://github.com/CTOverton/Keep-Google-Tasks-Updated</a></p>