title: Date Sorting with d3.js
body: <p>Disclaimer: I have no idea what I'm doing. Seriously, I love data viz and thought that doing it myself would be a great way to learn to program and use databases and make web apps like a cool guy. I've been at this searching for answer for the last day, and all the examples I could find I couldn't make work with my code.</p>
  
  <p>Here is a paste bin of the full code and data I'm using. It's the sample line chart found on the d3.js github with my data filled in.
  <a href="http://pastebin.com/7aW6wegd" rel="noreferrer">http://pastebin.com/7aW6wegd</a></p>
  
  <p>The json is coming from a couchdb database </p>
  
  <p>I can get the lines to draw, but they are a mess:</p>
  
  <p><img src="https://i.stack.imgur.com/EPb2x.jpg" alt="enter image description here"></p>
  
  <p>I THINK this is caused by the dates not sorting properly, since in console they are listed out of order. I can't figure out how to get the date's to sort properly. Using d3.time.format throws errors (you can actually see it in the code I've taken from the sample line chart, they use it to parse the dates. Using it with my data throws an error, even after I try to turn the timestamps to dates) and I can't seem to figure out how to get the dates to sort in couchdb either.</p>