title: Convert String to Date then to timestamp to add to firestore
body: <p>Okay so I've got two react native componenet DateTimePicker that I use to collect a date and time from the user using the following on change func</p>
  <pre class="lang-js prettyprint-override"><code> const onChangeDate = (event, selectedDate) =&gt; {
      const currentDate = selectedDate || date;
      setDateShow(Platform.OS === 'ios');
      setDate(currentDate);
  
      let tempDate = new Date(currentDate);
      let date = tempDate.getFullYear() + '-' + tempDate.getMonth() + '-' + tempDate.getDate();
  
      console.log(date); //2022-4-18
      setFinalDate(date);
    }
    const onChangeTime = (event, selectedTime) =&gt; {
      const currentTime = selectedTime || time;
      setTimeShow(Platform.OS === 'ios');
      setTime(currentTime);
  
      let tempDate = new Date(currentTime);
  
      let time = tempDate.getHours() + ':' + tempDate.getMinutes() + ':' + tempDate.getSeconds() + tempDate.getMilliseconds();
  
      console.log(time); //0:10:00
      setFinalTime(time);
    }
  </code></pre>
  <p>After setting a state for finalTime and finalDate</p>
  <pre class="lang-js prettyprint-override"><code>const eventTimestamp = (`${finalDate} ${finalTime}`); 
  console.log(eventTimestamp) // output is 2022-4-18 0:10:00
  
  </code></pre>
  <p>I cant seem to convert this into a date() object and then into a timestamp using toMillis() method becuse I want to add this into firestore as a timestamp.
  Converting it into a date using new Date() gives me <strong>Date { NaN }</strong> and using firestore method firebase.firestore.Timestamp.fromDate(works) gives me <strong>Object {
  &quot;nanoseconds&quot;: NaN,
  &quot;seconds&quot;: NaN,
  }</strong></p>
  <p>Any luck on where I'm going wrong?</p>