code: function compareDates(a, b) {
      var aTimestamp = convertToTimestamp(a);
      var bTimestamp = convertToTimestamp(b);
  
      if (isNaN(aTimestamp) || isNaN(bTimestamp)) {
        return NaN;
      } else {
        return aTimestamp - bTimestamp;
      }
    }
docs: Compares the given date representations. Returns a negative number if a is less than b, a positive number if a is greater than b, or zero if a and b are equal.