code: function calculateInverseIndicies(originalDates, sortedUniqueDates) {
    var originalDateStrings = originalDates.map(function(date) {
      return date && JulianDate.toIso8601(date);
    });
    var sortedUniqueDateStrings = sortedUniqueDates.map(function(date) {
      return date && JulianDate.toIso8601(date);
    });
    return originalDateStrings.map(function(s) {
      return sortedUniqueDateStrings.indexOf(s);
    });
  }
docs: Returns indices such that sortedUniqueDates[inverseIndices[k]] = originalDates[k]. Eg. var data = ['c', 'a', 'b', 'd']; var sortedData = data.slice().sort(); var inverseIndices = data.map(function(datum) { return sortedData.indexOf(datum); }); expect(inverseIndices).toEqual([2, 0, 1, 3]); However this works by converting the dates to strings first.