title: Sort a string date array, if date format:- "Feb-01-2018"?
body: <p>I want to sort an array according to month. The dates are in string format:-</p>
  
  <p><code>datesArray = [
    "May-17-2018",
    "Jan-06-1",
    "Nov-29-2018",
    "Nov-01-2018",
    "Apr-12-2018",
    "Aug-09-2018",
    "Feb-18-2018",
    "Feb-08-2018",
    "Jan-28-2018",
    "Jan-26-2018",
    "Mar-15-2018",
    "Oct-04-2018",
    "Jan-25-2018",
    "Jun-14-2018",
    "Dec-27-2018",
    "Jan-29-2018",
    "Jan-21-2018",
    "Jan-16-2018",
    "Jan-20-2018",
    "Mar-22-2018",
    "Feb-01-2018",
    "Mar-01-2018",
    "Mar-08-2018",
    "Apr-26-2018",
    "Feb-22-2018",
    "Apr-19-2018",
    "Mar-29-2018",
    "Sep-06-2018",
    "Apr-05-2018",
    "May-03-2018",
    "May-10-2018",
    "Feb-15-2018",
    "Jul-12-2018"
  ]</code></p>
  
  <p>I have implementd this code, but according to this code sort my number.</p>
  
  <pre><code> datesArray.sort(function(a,b) {
    a = a.split('-').reverse().join('');
    b = b.split('-').reverse().join('');
    return a &gt; b ? 1 : a &lt; b ? -1 : 0;
   });
  </code></pre>
  
  <p>Tell me how to done this. I have search so many, but can't find out any result.</p>