title: How to properly store date from form datepicker into mongodb with nodejs
body: <p>I'm using Angular Material 6's Datepicker and it displays the date using this format <strong>06/20/1992</strong> and in my browser console this is the output <strong>Sat Jun 20 1992 00:00:00 GMT+0800 (Philippine Standard Time)</strong>. Now when I console.log req.body in node, it outputs like this <strong>1992-06-19T16:00:00.000Z'</strong>. It is one day off.</p>
  
  <p>Below is what I've done so far.</p>
  
  <pre><code>var thisDate = new Date(req.body.birthdate);
  var currentMonth = thisDate.getMonth() + 1;
  var currentDay = thisDate.getDate();
  var currentYear = thisDate.getFullYear();
  
  console.log(thisDate); // 1992-06-19T16:00:00.000Z
  console.log(currentMonth + '/' + currentDay + '/' + currentYear); //6/20/1992
  </code></pre>
  
  <p>Is there a simpler way to do this? I'm going to save it to the database (mongodb)</p>