title: Javascript - Sort array of objects by date then by time
body: <p>I have the following array:</p>
  
  <pre><code>[{id: 1, value : "value1", date: "2018-08-08", time: "15:27:17"},
  {id: 2, value : "value2", date: "2018-08-09", time: "12:27:17"},
  {id: 3, value : "value3", date: "2018-08-10", time: "17:27:17"},
  {id: 4, value : "value4", date: "2018-08-11", time: "10:27:17"}]
  </code></pre>
  
  <p>How can I go about sorting the array from earliest to latest or vice versa?</p>
  
  <p>I tried sorting by date, but sorting it by time swaps the order of record id 4 to id 3, because it has an earlier time value than record 3, but is technically by definition, later.</p>
  
  <p>Given this array and json structure, how do I sort the array to take both fields (<code>date</code> and <code>time</code>) into consideration?</p>