lib/src/DayPickerInput.js
function defaultParse(str) {
  if (typeof str !== 'string') {
    return undefined;
  }
  var split = str.split('-');
  if (split.length !== 3) {
    return undefined;
  }
  var year = parseInt(split[0], 10);
  var month = parseInt(split[1], 10) - 1;
  var day = parseInt(split[2], 10);
  if (isNaN(year) || String(year).length > 4 || isNaN(month) || isNaN(day) || day <= 0 || day > 31 || month < 0 || month >= 12) {
    return undefined;
  }

  return new Date(year, month, day);
}
function defaultParse(str) {
  if (typeof str !== 'string') {
    return undefined;
  }
  var split = str.split('-');
  if (split.length !== 3) {
    return undefined;
  }
  var year = parseInt(split[0], 10);
  var month = parseInt(split[1], 10) - 1;
  var day = parseInt(split[2], 10);
  if (isNaN(year) || String(year).length > 4 || isNaN(month) || isNaN(day) || day <= 0 || day > 31 || month < 0 || month >= 12) {
    return undefined;
  }

  return new Date(year, month, day);
}
function defaultParse ( str ) { if ( typeof str !== 'string' ) { return undefined ; } var split = str . split ( '-' ) ; if ( split . length !== 3 ) { return undefined ; } var year = parseInt ( split [ 0 ] , 10 ) ; var month = parseInt ( split [ 1 ] , 10 ) - 1 ; var day = parseInt ( split [ 2 ] , 10 ) ; if ( isNaN ( year ) || String ( year ) . length > 4 || isNaN ( month ) || isNaN ( day ) || day <= 0 || day > 31 || month < 0 || month >= 12 ) { return undefined ; } return new Date ( year , month , day ) ; }
The default function used to parse a String as Date, passed to the `parse`
prop.
@param {String} str
@return {Date}
The default function used to parse a String as Date passed to the parse prop .