I have a fairly simple function that takes in array and loops through it. The length of this array could any length. Within the collection (item) is an entry called date1.

Tried applying this method, but got invalid date message: Return the latest date from array of dates

    function transform(context, input) {
       if (!input){ return ""; }
       for (i=0; i < input.length; i++) {
           var item = artifacts.Artifact(input[i]);
       return returnValue;

What I would like to achieve is to identify the element in the array which has the latest date (including the time) and return fields from that element.

0 Answers