title: Karate Framework - Why Javascript function returns an array with NaN values?
body: <p>I wrote javascript function in Karate scenario and the function takes in current date in argument and gets date, year, month and adds them in a array. But for some unknown reason I get NaN values. Please see below karate steps that I have been using.</p>
  
  <pre><code>    * def dateArr2 = []
      * def dateParse =
          """
              function(myOrderDate)
              {
                dateArr2.add(myOrderDate); // this is for test purpose
  
                var today = new Date(myOrderDate);
                var dd = today.getDate();     
                var mm = today.getMonth()+1; //January is 0!
                var yyyy = today.getFullYear();
                dateArr2.add(yyyy);
                dateArr2.add(mm);
                dateArr2.add(dd);               
              }
          """ 
     * def ongoingDateTime = "2018-10-19T11:53:39.8795965Z"
     * eval dateParse(ongoingDateTime)     
  </code></pre>
  
  <p>Note, the similar <code>javascript</code> code works for me if I am executing in <code>js</code> execution environment such as <code>sublime-text</code>.</p>