title: How to use d3.time.scale() to generate an array of evenly spaced dates?
body: <p>This seems like it should be trivial. I want to use <code>d3.time.scale()</code> to get an array of evenly spaced dates that covers a certain range of time. For example, years</p>
  
  <pre><code> [2012-01-01, 2013-01-01, 2014-01-01]
  </code></pre>
  
  <p>or months </p>
  
  <pre><code> [2012-01-01, 2012-02-01, 2012-03-01 ... 2014-12-01]
  </code></pre>
  
  <p>or whatever. </p>
  
  <p>So I start out like this:</p>
  
  <pre><code>var t = d3.time.scale()
      .domain(d3.extent(dates))
      .nice(d3.time.year);
  </code></pre>
  
  <p>I would then assume from the <a href="https://github.com/mbostock/d3/wiki/Time-Scales#wiki-ticks" rel="nofollow">documentation</a> that I'd be able to do this</p>
  
  <pre><code>var ticks = t.ticks(d3.time.month,1);
  </code></pre>
  
  <p>...but that just returns a single date. </p>
  
  <p>This gives me an array of months</p>
  
  <pre><code>var ticks = t.ticks(30)
  </code></pre>
  
  <p>...but only because I told it roughly how many ticks to generate (30), which I won't know in advance (unless I do some heavy lifting on my own, which kind of defeats the purpose of using d3 for this). </p>
  
  <p>I don't understand why it's not working to just tell it that I want every year, or every month, or every 3 months, or whatever.</p>
  
  <p>I've put up a fiddle here: <a href="http://jsfiddle.net/herbcaudill/LgGpd/4/" rel="nofollow">http://jsfiddle.net/herbcaudill/LgGpd/4/</a></p>