code: function compareTimes(a, b) {
      if (typeof a !== 'string' || typeof b !== 'string') {
        return NaN;
      }
  
      var aTimePieces = extractIso8601TimePieces(a);
      var bTimePieces = extractIso8601TimePieces(b);
  
      if (aTimePieces === null || bTimePieces === null) {
        return NaN;
      }
  
      for (var timePieceIndex = 0; timePieceIndex < aTimePieces.length; timePieceIndex++) {
        if (aTimePieces[timePieceIndex] < bTimePieces[timePieceIndex]) {
          return -1;
        } else if (aTimePieces[timePieceIndex] > bTimePieces[timePieceIndex]) {
          return 1;
        }
      }
  
      // If we got here, the two parameters represent the same time of day
      return 0;
    }
docs: Compares the given time strings. 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.