title: Using react native date time picker twice gives an error?
body: <p>I use expo's <a href="https://docs.expo.io/versions/latest/sdk/date-time-picker/" rel="nofollow noreferrer">datetime</a> picker and it works perfectly fine if I click on it only once. If I click on it twice it gives me the following error:</p>
  <blockquote>
  <p>TypeError: value.getTime is not a function. (In 'value.getTime()',
  'value.getTime' is undefined)</p>
  <p>This error is located at:
  in RNDateTimePicker (at MyDateTimePicker.js:52)</p>
  </blockquote>
  <p>This is my date time picker:</p>
  <pre><code>import React, { useState, useEffect } from 'react';
  import { View, Text, TextInput, Image, Button, StyleSheet, TouchableOpacity } from 'react-native';
  import DateTimePicker from '@react-native-community/datetimepicker';
  import Moment from 'moment';
  
  export default function MyDateTimePicker(props) {
    console.log(&quot;my date time picker props: &quot;, props);
    const title = props.title;
    const [date, setDate] = useState(new Date());
    const [time, setTime] = useState(new Date());
    const [mode, setMode] = useState('date');
    const [show, setShow] = useState(false);
    const [text, setText] = useState(Moment(date).format('DD MMM YYYY HH:mm'));
  
    const onChange = (event, selectedValue) =&gt; {
      setShow(Platform.OS === 'ios');
      if (mode == 'date') {
       const currentDate = selectedValue || new Date();
       setDate(new Date(currentDate));
       setMode('time');
       setShow(Platform.OS !== 'ios'); // to show time
     } else {
       const currentTime = selectedValue || new Date();
       setDate(date.setTime(currentTime.getTime()));
       setShow(Platform.OS === 'ios'); // to hide back the picker
       setMode('date'); // defaulting to date for next open
     }
     props.updateDate(date);
    };
  
    const showMode = (currentMode) =&gt; {
      setShow(true);
      setMode(currentMode);
    };
  
    const showDatepicker = () =&gt; {
      console.log(&quot;show date picker&quot;);
      showMode('date');
    };
  
    const showTimepicker = () =&gt; {
      console.log(&quot;show time picker&quot;);
      showMode('time');
    };
  
    return(
      &lt;View style={styles.viewStyle}&gt;
        &lt;TouchableOpacity onPress={showDatepicker}&gt;
          &lt;Text style={styles.inputStyle}&gt;{text}&lt;/Text&gt;
        &lt;/TouchableOpacity&gt;
        {show &amp;&amp; (
          &lt;DateTimePicker
            value={date}
            mode={mode}
            is24Hour={true}
            display=&quot;default&quot;
            onChange={onChange}
            minimumDate={new Date()}
            showTimeSelect
          /&gt;
        )}
      &lt;/View&gt;
    )
  }
  </code></pre>
  <p>And this is how I use it:</p>
  <pre><code>&lt;MyDateTimePicker updateDate={(date) =&gt; this.handleDate(date)} /&gt;
  </code></pre>
  <p>Where</p>
  <pre><code>handleDate(date) {
      this.setState({date: date});
    }
  </code></pre>
  <p>Again, if I click on the date-time picker only once, it all works fine, but if I try to select second date it breaks and I dont see why.</p>