title: Javascript slice method not working as expected
body: <p>I wrote a simple javascript function which converts string to date (in format 'dd.MM.yyyy HH.mm').</p>
  
  <p>For extracting parts of that string, I've used <code>slice</code> method.
  What is strange to me is that only day is returned as expected. All other variables are simply empty strings. 
  What am I doing wrong?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>(
    function(){
    alert(GetDateFromStringDateTime("20.04.2017 18:15"));
      
      
    }
    
    
  )();
  
  
    function GetDateFromStringDateTime(dateStr){
    
    var day = dateStr.slice(0,2);
    var month = dateStr.slice(3,2);
    var year = dateStr.slice(6,4);
    var hour = dateStr.slice(11,2);
    var minute = dateStr.slice(14,2);
    
    return new Date(year,month,day,hour,minute);
    
    
    
    
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Picture from console window (month, year, hour and minute are empty strings):</p>
  
  <p><a href="https://i.stack.imgur.com/Pfyzi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Pfyzi.png" alt="enter image description here"></a></p>