MCPcopy Index your code
hub / github.com/feiyu563/PrometheusAlert / configFromISO

Function configFromISO

static/plugins/chart.js/Chart.bundle.js:16922–16972  ·  view source on GitHub ↗
(config)

Source from the content-addressed store, hash-verified

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}))$/;

Callers 2

configFromStringFunction · 0.85

Calls 2

getParsingFlagsFunction · 0.85

Tested by

no test coverage detected