title: How can I get the nearest date through moment.js?
body: <p>Dates list:</p>
  
  <pre><code>const datesToBeChecked = [ '2020-07-06', '2020-07-13', '2020-07-20' ]
  </code></pre>
  
  <p>Date to be checked for</p>
  
  <pre><code>const dateToCheckFor = '2020-07-07';
  </code></pre>
  
  <p>How can I get the nearest date for the date in the dates array using moment.js?<br>
  I want the function to return <code>2020-07-13</code> in this case.<br>
  I found a couple of answers online but none of them use YYYY-MM-DD format neither moment.js. I want to use moment.js to achieve this, thanks!</p>