function configFromStringAndFormat(config) {
	      // TODO: Move this to another part of the creation flow to prevent circular deps
	      if (config._f === hooks.ISO_8601) {
	        configFromISO(config);
	        return;
	      }

	      if (config._f === hooks.RFC_2822) {
	        configFromRFC2822(config);
	        return;
	      }

	      config._a = [];
	      getParsingFlags(config).empty = true; // This array is used to make a Date, either with `new Date` or `Date.UTC`

	      var string = '' + config._i,
	          i,
	          parsedInput,
	          tokens,
	          token,
	          skipped,
	          stringLength = string.length,
	          totalParsedInputLength = 0;
	      tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];

	      for (i = 0; i < tokens.length; i++) {
	        token = tokens[i];
	        parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0]; // console.log('token', token, 'parsedInput', parsedInput,
	        //         'regex', getParseRegexForToken(token, config));

	        if (parsedInput) {
	          skipped = string.substr(0, string.indexOf(parsedInput));

	          if (skipped.length > 0) {
	            getParsingFlags(config).unusedInput.push(skipped);
	          }

	          string = string.slice(string.indexOf(parsedInput) + parsedInput.length);
	          totalParsedInputLength += parsedInput.length;
	        } // don't parse if it's not a known token


	        if (formatTokenFunctions[token]) {
	          if (parsedInput) {
	            getParsingFlags(config).empty = false;
	          } else {
	            getParsingFlags(config).unusedTokens.push(token);
	          }

	          addTimeToArrayFromToken(token, parsedInput, config);
	        } else if (config._strict && !parsedInput) {
	          getParsingFlags(config).unusedTokens.push(token);
	        }
	      } // add remaining unparsed input length to the string


	      getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength;

	      if (string.length > 0) {
	        getParsingFlags(config).unusedInput.push(string);
	      } // clear _12h flag if hour is <= 12


	      if (config._a[HOUR] <= 12 && getParsingFlags(config).bigHour === true && config._a[HOUR] > 0) {
	        getParsingFlags(config).bigHour = undefined;
	      }

	      getParsingFlags(config).parsedDateParts = config._a.slice(0);
	      getParsingFlags(config).meridiem = config._meridiem; // handle meridiem

	      config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem);
	      configFromArray(config);
	      checkOverflow(config);
	    }
// date from string and format string
date from string and format string
date from string and format string
function configFromStringAndFormat(config) {
	      if (config._f === hooks.ISO_8601) {
	        configFromISO(config);
	        return;
	      }
	      if (config._f === hooks.RFC_2822) {
	        configFromRFC2822(config);
	        return;
	      }
	      config._a = [];
	      getParsingFlags(config).empty = true; 
	      var string = '' + config._i,
	          i,
	          parsedInput,
	          tokens,
	          token,
	          skipped,
	          stringLength = string.length,
	          totalParsedInputLength = 0;
	      tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];
	      for (i = 0; i < tokens.length; i++) {
	        token = tokens[i];
	        parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0]; 
	        if (parsedInput) {
	          skipped = string.substr(0, string.indexOf(parsedInput));
	          if (skipped.length > 0) {
	            getParsingFlags(config).unusedInput.push(skipped);
	          }
	          string = string.slice(string.indexOf(parsedInput) + parsedInput.length);
	          totalParsedInputLength += parsedInput.length;
	        } 
	        if (formatTokenFunctions[token]) {
	          if (parsedInput) {
	            getParsingFlags(config).empty = false;
	          } else {
	            getParsingFlags(config).unusedTokens.push(token);
	          }
	          addTimeToArrayFromToken(token, parsedInput, config);
	        } else if (config._strict && !parsedInput) {
	          getParsingFlags(config).unusedTokens.push(token);
	        }
	      } 
	      getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength;
	      if (string.length > 0) {
	        getParsingFlags(config).unusedInput.push(string);
	      } 
	      if (config._a[HOUR] <= 12 && getParsingFlags(config).bigHour === true && config._a[HOUR] > 0) {
	        getParsingFlags(config).bigHour = undefined;
	      }
	      getParsingFlags(config).parsedDateParts = config._a.slice(0);
	      getParsingFlags(config).meridiem = config._meridiem; 
	      config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem);
	      configFromArray(config);
	      checkOverflow(config);
	    }
function configFromStringAndFormat ( config ) { if ( config . _f === hooks . ISO_8601 ) { configFromISO ( config ) ; return ; } if ( config . _f === hooks . RFC_2822 ) { configFromRFC2822 ( config ) ; return ; } config . _a = [ ] ; getParsingFlags ( config ) . empty = true ; var string = '' + config . _i , i , parsedInput , tokens , token , skipped , stringLength = string . length , totalParsedInputLength = 0 ; tokens = expandFormat ( config . _f , config . _locale ) . match ( formattingTokens ) || [ ] ; for ( i = 0 ; i < tokens . length ; i ++ ) { token = tokens [ i ] ; parsedInput = ( string . match ( getParseRegexForToken ( token , config ) ) || [ ] ) [ 0 ] ; if ( parsedInput ) { skipped = string . substr ( 0 , string . indexOf ( parsedInput ) ) ; if ( skipped . length > 0 ) { getParsingFlags ( config ) . unusedInput . push ( skipped ) ; } string = string . slice ( string . indexOf ( parsedInput ) + parsedInput . length ) ; totalParsedInputLength += parsedInput . length ; } if ( formatTokenFunctions [ token ] ) { if ( parsedInput ) { getParsingFlags ( config ) . empty = false ; } else { getParsingFlags ( config ) . unusedTokens . push ( token ) ; } addTimeToArrayFromToken ( token , parsedInput , config ) ; } else if ( config . _strict && ! parsedInput ) { getParsingFlags ( config ) . unusedTokens . push ( token ) ; } } getParsingFlags ( config ) . charsLeftOver = stringLength - totalParsedInputLength ; if ( string . length > 0 ) { getParsingFlags ( config ) . unusedInput . push ( string ) ; } if ( config . _a [ HOUR ] <= 12 && getParsingFlags ( config ) . bigHour === true && config . _a [ HOUR ] > 0 ) { getParsingFlags ( config ) . bigHour = undefined ; } getParsingFlags ( config ) . parsedDateParts = config . _a . slice ( 0 ) ; getParsingFlags ( config ) . meridiem = config . _meridiem ; config . _a [ HOUR ] = meridiemFixWrap ( config . _locale , config . _a [ HOUR ] , config . _meridiem ) ; configFromArray ( config ) ; checkOverflow ( config ) ; }
date from string and format string
date from string and format string
// TODO: Move this to another part of the creation flow to prevent circular deps // This array is used to make a Date, either with `new Date` or `Date.UTC` // console.log('token', token, 'parsedInput', parsedInput, //         'regex', getParseRegexForToken(token, config)); // don't parse if it's not a known token // add remaining unparsed input length to the string // clear _12h flag if hour is <= 12 // handle meridiem