title: Node.js converting date string to unix timestamp
body: <p>I'm attempting to convert a Date String to a unix timestamp in Node.js.</p>
  
  <p>My code below works perfectly on my client but when I run it on my server I get an error: </p>
  
  <blockquote>
    <p>(node:19260) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: input.substring is not a function</p>
  </blockquote>
  
  <p>My code:</p>
  
  <pre><code>function dateParser(input) {
      // function is passed a date and parses it to create a unix timestamp
  
      // removing the '.000' from input
      let finalDate = input.substring(0, input.length - 4);
      return new Date(finalDate.split(' ').join('T')).getTime();
  }
  </code></pre>
  
  <p>Example of my input would be <strong>2017-09-15 00:00:00.000</strong></p>
  
  <p>So why does the above work on my client but not in Node, and how would I duplicate the functionality in node?</p>