title: Throwing error RangeError: Invalid time value while setting custom date to DatePicker of react-datepicker
body: <p>I'm trying to set selected parameter as default date of DatePicker of <a href="https://www.npmjs.com/package/react-datepicker" rel="nofollow noreferrer">react-datepicker</a>. Basically date which I'm getting from database is in following format: </p>
  
  <p><code>event_date: "2019-06-15"</code></p>
  
  <p>and when I set state, that date shows in this way - <code>event_date: "2019-06-15T00:00:00"</code></p>
  
  <p>I have tried to <code>new Date()</code> for converting it into JavaScript compatible date. Also tried <a href="https://momentjs.com/" rel="nofollow noreferrer">MomentJS</a> but then also it's throwing same error. When I call <code>new Date()</code> in <code>selected</code> parameter then everything works perfectly. I mean, DatePicker shows default todays date. But when I try to set custom date value to DatePicker, it throws error - <code>RangeError: Invalid time value</code>.</p>
  
  <p>Can anyone tell me what type of data DatePicker need for setting custom date?</p>