(config)
| 16920 | |
| 16921 | // date from iso format |
| 16922 | function configFromISO(config) { |
| 16923 | var i, l, |
| 16924 | string = config._i, |
| 16925 | match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string), |
| 16926 | allowTime, dateFormat, timeFormat, tzFormat; |
| 16927 | |
| 16928 | if (match) { |
| 16929 | getParsingFlags(config).iso = true; |
| 16930 | |
| 16931 | for (i = 0, l = isoDates.length; i < l; i++) { |
| 16932 | if (isoDates[i][1].exec(match[1])) { |
| 16933 | dateFormat = isoDates[i][0]; |
| 16934 | allowTime = isoDates[i][2] !== false; |
| 16935 | break; |
| 16936 | } |
| 16937 | } |
| 16938 | if (dateFormat == null) { |
| 16939 | config._isValid = false; |
| 16940 | return; |
| 16941 | } |
| 16942 | if (match[3]) { |
| 16943 | for (i = 0, l = isoTimes.length; i < l; i++) { |
| 16944 | if (isoTimes[i][1].exec(match[3])) { |
| 16945 | // match[2] should be 'T' or space |
| 16946 | timeFormat = (match[2] || ' ') + isoTimes[i][0]; |
| 16947 | break; |
| 16948 | } |
| 16949 | } |
| 16950 | if (timeFormat == null) { |
| 16951 | config._isValid = false; |
| 16952 | return; |
| 16953 | } |
| 16954 | } |
| 16955 | if (!allowTime && timeFormat != null) { |
| 16956 | config._isValid = false; |
| 16957 | return; |
| 16958 | } |
| 16959 | if (match[4]) { |
| 16960 | if (tzRegex.exec(match[4])) { |
| 16961 | tzFormat = 'Z'; |
| 16962 | } else { |
| 16963 | config._isValid = false; |
| 16964 | return; |
| 16965 | } |
| 16966 | } |
| 16967 | config._f = dateFormat + (timeFormat || '') + (tzFormat || ''); |
| 16968 | configFromStringAndFormat(config); |
| 16969 | } else { |
| 16970 | config._isValid = false; |
| 16971 | } |
| 16972 | } |
| 16973 | |
| 16974 | // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3 |
| 16975 | var rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/; |
no test coverage detected