title: How to iterate through days and account for daylight savings time?
body: <p>I have a mongoDB script where I am iterating through each day and running some calculations.  I have run into some unexpected behavior around March 13th, which I believe is daylight savings time.  My code looks something like this:</p>
  
  <pre><code>var startDate = ISODate("2016-01-02T00:00:00Z")
  var endDate = ISODate("2019-03-18T00:00:00Z")
  while(startDate &lt; endDate){
    print(startDate);
    startDate.setDate(startDate.getDate() + 1)
  }
  </code></pre>
  
  <p>The output is as expected until March 13th:</p>
  
  <pre><code>ISODate("2016-03-11T00:00:00Z")
  ISODate("2016-03-12T00:00:00Z")
  ISODate("2016-03-13T00:00:00Z")
  ISODate("2016-03-13T23:00:00Z")  &lt;----- here
  ISODate("2016-03-14T23:00:00Z")
  </code></pre>
  
  <p>I'd like to have each date at the same time (<code>T00:00:00</code>).  Can anyone suggest a way around this?  Should I look at using a different method to increment the date?</p>