title: Sort javascript object based on date keys
body: <p>I have a JavaScript object that looks like follows</p>
  
  <pre><code>testObj = {
      1/10/2015: {},
      2/10/2015: {},
      3/10/2015: {},
      4/10/2015: {},
      29/09/2015: {},
      30/09/2015: {}
  }
  </code></pre>
  
  <p>Now, I'm trying to sort this such that the dates are arranged by date in increasing order. For that i've done the following</p>
  
  <pre><code>const orderedDates = {};
  Object.keys(testObj).sort(function(a, b) {
      return moment(moment(b, 'DD/MM/YYYY') - moment(a, 'DD/MM/YYYY')).format('DD/MM/YYYY');
  }).forEach(function(key) {
      orderedDates[key] = testObj[key];
  })
  rangeObj = orderedDates;
  </code></pre>
  
  <p>This however is not sorting the dates at all. It still returns the same exact object as <code>testObj</code>. How do I sort the object based on date keys?</p>