function parseISO(argument, dirtyOptions) {
  __WEBPACK_IMPORTED_MODULE_1__lib_requiredArgs_index_js__["a" /* default */](1, arguments);
  var options = dirtyOptions || {};
  var additionalDigits = options.additionalDigits == null ? DEFAULT_ADDITIONAL_DIGITS : __WEBPACK_IMPORTED_MODULE_0__lib_toInteger_index_js__["a" /* default */](options.additionalDigits);

  if (additionalDigits !== 2 && additionalDigits !== 1 && additionalDigits !== 0) {
    throw new RangeError('additionalDigits must be 0, 1 or 2');
  }

  if (!(typeof argument === 'string' || Object.prototype.toString.call(argument) === '[object String]')) {
    return new Date(NaN);
  }

  var dateStrings = splitDateString(argument);
  var date;

  if (dateStrings.date) {
    var parseYearResult = parseYear(dateStrings.date, additionalDigits);
    date = parseDate(parseYearResult.restDateString, parseYearResult.year);
  }

  if (isNaN(date) || !date) {
    return new Date(NaN);
  }

  var timestamp = date.getTime();
  var time = 0;
  var offset;

  if (dateStrings.time) {
    time = parseTime(dateStrings.time);

    if (isNaN(time) || time === null) {
      return new Date(NaN);
    }
  }

  if (dateStrings.timezone) {
    offset = parseTimezone(dateStrings.timezone);

    if (isNaN(offset)) {
      return new Date(NaN);
    }
  } else {
    var dirtyDate = new Date(timestamp + time); // js parsed string assuming it's in UTC timezone
    // but we need it to be parsed in our timezone
    // so we use utc values to build date in our timezone.
    // Year values from 0 to 99 map to the years 1900 to 1999
    // so set year explicitly with setFullYear.

    var result = new Date(dirtyDate.getUTCFullYear(), dirtyDate.getUTCMonth(), dirtyDate.getUTCDate(), dirtyDate.getUTCHours(), dirtyDate.getUTCMinutes(), dirtyDate.getUTCSeconds(), dirtyDate.getUTCMilliseconds());
    result.setFullYear(dirtyDate.getUTCFullYear());
    return result;
  }

  return new Date(timestamp + time + offset);
}
@name parseISO
@category Common Helpers
@summary Parse ISO string

@description
Parse the given string in ISO 8601 format and return an instance of Date.

Function accepts complete ISO 8601 formats as well as partial implementations.
ISO 8601: http://en.wikipedia.org/wiki/ISO_8601

If the argument isn't a string, the function cannot parse the string or
the values are invalid, it returns Invalid Date.

### v2.0.0 breaking changes:

- [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).

- The previous `parse` implementation was renamed to `parseISO`.

  ```javascript
  // Before v2.0.0
  parse('2016-01-01')

  // v2.0.0 onward
  parseISO('2016-01-01')
  ```

- `parseISO` now validates separate date and time values in ISO-8601 strings
  and returns `Invalid Date` if the date is invalid.

  ```javascript
  parseISO('2018-13-32')
  //=> Invalid Date
  ```

- `parseISO` now doesn't fall back to `new Date` constructor
  if it fails to parse a string argument. Instead, it returns `Invalid Date`.

@param {String} argument - the value to convert
@param {Object} [options] - an object with options.
@param {0|1|2} [options.additionalDigits=2] - the additional number of digits in the extended year format
@returns {Date} the parsed date in the local time zone
@throws {TypeError} 1 argument required
@throws {RangeError} `options.additionalDigits` must be 0, 1 or 2

@example
// Convert string '2014-02-11T11:30:30' to date:
var result = parseISO('2014-02-11T11:30:30')
//=> Tue Feb 11 2014 11:30:30

@example
// Convert string '+02014101' to date,
// if the additional number of digits in the extended year format is 1:
var result = parseISO('+02014101', { additionalDigits: 1 })
//=> Fri Apr 11 2014 00:00:00