title: Passing correct value to moment.js `toDate() function`
body: <p>In my timepicker component in my react-native app I need to pass a value into moment's <code>toDate()</code> function, because that's the format the component requires.</p>
  <p>The value I have is a clock value, coming in as a string, such as &quot;14:23&quot;.</p>
  <p>My question is, how can I take that clock string value, attach it to a date, and then format it in such a way that I can pass that all in as the value for <code>val</code> to be passed in here:</p>
  <pre><code> this.value = moment(val).toDate();
  </code></pre>
  <p>I tried this:</p>
  <pre><code>const val = &quot;14:24&quot;
  
  const m = moment(`2022-02-19:${val}`);
  console.log('isValid: ', m.isValid()); // false
  </code></pre>
  <p>But this fails.</p>
  <p>But, for that matter, so does this:</p>
  <pre><code>const m = moment(&quot;2011-10-10T10:20:90&quot;);
  console.log('isValid: ', m.isValid()); // false
  </code></pre>
  <p>So I guess that's not surprising, and suggests there's something I'm not understanding here. Bottom line how can I format a value, with a string value like &quot;14:24&quot;, and then pass it to moment's <code>toDate()</code> function?</p>
  <pre><code>  this.value = moment(val).toDate();
  </code></pre>