title: D3 date range by hour; day repeats every 7 days
body: <p>So, I am working on a visualization that calculates the angle and distance of the sun at a specific location for each hour of every day in a year. The calculations take up about 550 lines of code, so I'll leave that code out. I'm using the D3 library to get the range of hours and relative day, month, and year of the range of dates. To get the range, I am using this line of code.</p>
  
  <pre><code>var hourRange = d3.time.hours(new Date(2013, 1, 1), new Date(2013, 12, 31));
  </code></pre>
  
  <p>After getting the calculations to work, I got very excited. Having 8736 objects holding the 9 values,</p>
  
  <pre><code>hourRange[i] = [hour, day, month, year, solar azimuth angle, solar elevation angle, EOT, solar declination angle, cosine of solar zenith angle]
  </code></pre>
  
  <p>... and finally starting the visualization process, I found that the day values went from 0-6, but instead of increasing until the end of the month, continued to repeat 0-6 until the end of the month and started the 0-6 value loop over again. Thinking this may be an issue from the calculations, I tried printing out the day value of the hour range directly and found the same issue happening. Reading the Time Interval API Reference for the D3 library, this seems to be an anomalous error.</p>
  
  <p>Does anyone know why this is happening, as well as any solutions to get the range of hours and their relative dates without this issue of the day value repeating every week? Any insight to this will be greatly appreciated!</p>
  
  <p><strong>EDIT: To be clear. When type hourRange[500] in the console, it returns:</strong></p>
  
  <pre><code>Date 2013-02-22T01:00:00.000Z
  </code></pre>
  
  <p><strong>But, when I type hourRange[500].getDay() in the console, it returns:</strong></p>
  
  <pre><code>4
  </code></pre>
  
  <p><strong>when it should clearly be 22.</strong></p>