@@ 2426-2452 (lines=27) @@ | ||
2423 | ||
2424 | tokens = expandFormat(config._f, config._locale).match(formattingTokens) || []; |
|
2425 | ||
2426 | for (i = 0; i < tokens.length; i++) { |
|
2427 | token = tokens[i]; |
|
2428 | parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0]; |
|
2429 | // console.log('token', token, 'parsedInput', parsedInput, |
|
2430 | // 'regex', getParseRegexForToken(token, config)); |
|
2431 | if (parsedInput) { |
|
2432 | skipped = string.substr(0, string.indexOf(parsedInput)); |
|
2433 | if (skipped.length > 0) { |
|
2434 | getParsingFlags(config).unusedInput.push(skipped); |
|
2435 | } |
|
2436 | string = string.slice(string.indexOf(parsedInput) + parsedInput.length); |
|
2437 | totalParsedInputLength += parsedInput.length; |
|
2438 | } |
|
2439 | // don't parse if it's not a known token |
|
2440 | if (formatTokenFunctions[token]) { |
|
2441 | if (parsedInput) { |
|
2442 | getParsingFlags(config).empty = false; |
|
2443 | } |
|
2444 | else { |
|
2445 | getParsingFlags(config).unusedTokens.push(token); |
|
2446 | } |
|
2447 | addTimeToArrayFromToken(token, parsedInput, config); |
|
2448 | } |
|
2449 | else if (config._strict && !parsedInput) { |
|
2450 | getParsingFlags(config).unusedTokens.push(token); |
|
2451 | } |
|
2452 | } |
|
2453 | ||
2454 | // add remaining unparsed input length to the string |
|
2455 | getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength; |
@@ 1766-1790 (lines=25) @@ | ||
1763 | ||
1764 | tokens = expandFormat(config._f, config._locale).match(formattingTokens) || []; |
|
1765 | ||
1766 | for (i = 0; i < tokens.length; i++) { |
|
1767 | token = tokens[i]; |
|
1768 | parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0]; |
|
1769 | if (parsedInput) { |
|
1770 | skipped = string.substr(0, string.indexOf(parsedInput)); |
|
1771 | if (skipped.length > 0) { |
|
1772 | config._pf.unusedInput.push(skipped); |
|
1773 | } |
|
1774 | string = string.slice(string.indexOf(parsedInput) + parsedInput.length); |
|
1775 | totalParsedInputLength += parsedInput.length; |
|
1776 | } |
|
1777 | // don't parse if it's not a known token |
|
1778 | if (formatTokenFunctions[token]) { |
|
1779 | if (parsedInput) { |
|
1780 | config._pf.empty = false; |
|
1781 | } |
|
1782 | else { |
|
1783 | config._pf.unusedTokens.push(token); |
|
1784 | } |
|
1785 | addTimeToArrayFromToken(token, parsedInput, config); |
|
1786 | } |
|
1787 | else if (config._strict && !parsedInput) { |
|
1788 | config._pf.unusedTokens.push(token); |
|
1789 | } |
|
1790 | } |
|
1791 | ||
1792 | // add remaining unparsed input length to the string |
|
1793 | config._pf.charsLeftOver = stringLength - totalParsedInputLength; |