title: How to sort array by date?
body: <p>I have following data:</p>
  <pre><code>const data = 
  [{date: &quot;2022-05-10 13:36:00&quot;, open: 155.535, low: 155.4, high: 155.67, close: 155.44},
  {date: &quot;2022-05-10 13:35:00&quot;, open: 155.23, low: 155.2102, high: 155.62, close: 155.53},
  {date: &quot;2022-05-10 13:34:00&quot;, open: 154.97, low: 154.96, high: 155.29, close: 155.22}];
  
  </code></pre>
  <p>I am using following code to sort the data by date (oldest to newest):</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const data = 
  [{date: "2022-05-10 13:36:00", open: 155.535, low: 155.4, high: 155.67, close: 155.44},
  {date: "2022-05-10 13:35:00", open: 155.23, low: 155.2102, high: 155.62, close: 155.53},
  {date: "2022-05-10 13:34:00", open: 154.97, low: 154.96, high: 155.29, close: 155.22}];
  console.log(Object.entries(data).sort((([, a], [, b]) =&gt; {
      return new Date(a.date) - new Date(b.date)
    })).map(i=&gt;{ return i[1]}))</code></pre>
  </div>
  </div>
  </p>
  <p>In chrome, it renders pretty well, but on safari, it will not work and will maintain the original order.</p>
  <p>My question is what makes this difference and how to make the sort algorithem work in all broswer?</p>
  <p>Thanks!</p>
  <p>P.S. I do check this question, <a href="https://stackoverflow.com/questions/49899771/chrome-and-safari-javascript-sort-method-works-differently">Chrome and Safari javascript .sort() method works differently</a>, but the answers indicated that <code>The sort is not necessarily stable</code>, but according to mdn now:</p>
  <blockquote>
  <p>Since version 10 (or EcmaScript 2019), the specification dictates that Array.prototype.sort is stable.</p>
  </blockquote>
  <p>What I am missing?</p>