title: Javascript increment and decrement YYYY-MM-DD by 1 day
body: <p>I got this from another stack question</p>
  
  <pre><code>incr_date(date_str){
      let parts = date_str.split("-");
      let dt = new Date(
      parseInt(parts[0], 10),      // year
      parseInt(parts[1], 10) - 1,  // month (starts with 0)
      parseInt(parts[2], 10)       // date
      );
      dt.setDate(dt.getDate() + 1);
      parts[0] = "" + dt.getFullYear();
      parts[1] = "" + (dt.getMonth() + 1);
      if (parts[1].length &lt; 2) {
      parts[1] = "0" + parts[1];
      }
      parts[2] = "" + dt.getDate();
      if (parts[2].length &lt; 2) {
      parts[2] = "0" + parts[2];
      }
      return parts.join("-");
  }
  </code></pre>
  
  <p>It works but how can I convert this function to decrement the date instead of increment?</p>
  
  <p>I'm doing this on a react native component so I dont want to import any javascript libraries like moment.js</p>