title: Why date validation in Google sheets rejects today's date before 8:00am?
body: <p>I've created a Google sheet to keep a list of work tasks with a column to track the date on which items are created, and built a script to automatically populate the cells in that column with the day's date when a new line is inserted.   </p>
  
  <p>The cell (e.g. G9) that is target of the script uses the following validation formula  to make sure that when users change the date, they use a date that is neither a weekend nor in the future:    </p>
  
  <p><code>=and(isdate(G9), weekday(G9,2)&lt;6, G9&lt;=today())</code></p>
  
  <p>IT ONLY WORKS BUT ONLY IF THE SCRIPT IS RUN ANYTIME AFTER 8:00am !  If I try using it any earlier the cell validation will reject the input!</p>
  
  <p>The script looks like this (curRow is the number of the row that's been added):</p>
  
  <pre><code> // Adds today's date without using =today()
    var myrangename = "G"+curRow;
    var dateCell = sheet.getRange(myrangename);
    var d = new Date();
    var dateArr = [];
    dateArr[0]=d.getFullYear();
    dateArr[1]=d.getMonth() + 1; //Months are zero based
    dateArr[2]=d.getDate();
    dateCell.setValue(dateArr.join('/'));
  </code></pre>
  
  <p>(n.b.:  I cannot use the script to simply put <code>=today()</code> in the cell because all the entries would change every day. ) </p>
  
  <p>WHY DOES IT ONLY WORK AFTER 8:00AM? Is Google somehow running on a different time zone than my computer?? I'm based in the UK, so using <code>BST</code>, but that shouldn't be a problem, shouldn't it...?</p>