title: how to add minutes to Date() in react-native?
body: <p>I want to add 5 minutes to current time and store it to this.state.date.</p>
  
  <p>However,</p>
  
  <pre><code>this.setState({
      date: new Date() + new Date(0,0,0,0,0,5,0),
  });
  </code></pre>
  
  <p>gives me some strange error, saying </p>
  
  <p>`props.date.getTime is not a function. (In 'props.date.getTime()', 'props.date.getTime' is undefined)</p>
  
  <p>DatePickerIOS_render
  DatePickerIOS.ios.js:125</p>
  
  <p>EDITED: According to <a href="https://stackoverflow.com/questions/1197928/how-to-add-30-minutes-to-a-javascript-date-object">this</a> post I also tried below,</p>
  
  <pre><code>this.setState({
      date: this.state.date.setMinutes((new Date()).getMinutes()+5)
  });
  </code></pre>
  
  <p>but it still gives me the same error message. What is the correct way to add minutes to Date() in react-native?</p>
  
  <p>Btw, I'm using datepickerios on another part of the app, and not sure why the error is related to DatePickerIOS.ios.js in the first place. The other part of the app which actually uses the DatePickerIOS works fine without error.</p>
  
  <p>EDITED AGAIN:</p>
  
  <p>Below is the full function. This function is called from a SegmentedControlIOS which has values ['5min from now', '15min from now', '30min from now', 'custom'].</p>
  
  <pre><code>_onTimeChange = (event) =&gt; {
  
      switch (event.nativeEvent.selectedSegmentIndex) {
          case 0:
          // 5min
              return this.setState({
                  date: this.state.date.setMinutes((new Date()).getMinutes()+5),
                  time: this.state.date.toLocaleTimeString()
              });
          case 1:
          // 15min
              return this.setState({
                  date: this.state.date.setMinutes((new Date()).getMinutes()+15),
                  time: this.state.date.toLocaleTimeString()
              });
          case 2:
          // 30min
              return this.setState({
                  date: this.state.date.setMinutes((new Date()).getMinutes()+30),
                  time: this.state.date.toLocaleTimeString()
              });
          case 3: 
          // show modal with datepicker (this one works fine)
              return this.setModalVisible(true);
      }
    }
  </code></pre>
  
  <p>What happens: If I change selection from the segmented control once, a yellow warning bar with props error message is shown at the bottom of my simulator. If I change selection once again, then the red screen shows up with '_this5.state.date.setMinutes is not a function'.</p>
  
  <p>So it looks like</p>
  
  <pre><code>date: this.state.date.setMinutes((new Date()).getMinutes()+5)
  </code></pre>
  
  <p>does add minutes, but when I do it twice it ends up in error.
  Please help!</p>