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

Function configFromArray

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

Source from the content-addressed store, hash-verified

16756 // note: all values past the year are optional and will default to the lowest possible value.
16757 // [year, month, day , hour, minute, second, millisecond]
16758 function configFromArray (config) {
16759 var i, date, input = [], currentDate, expectedWeekday, yearToUse;
16760
16761 if (config._d) {
16762 return;
16763 }
16764
16765 currentDate = currentDateArray(config);
16766
16767 //compute day of the year from weeks and weekdays
16768 if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
16769 dayOfYearFromWeekInfo(config);
16770 }
16771
16772 //if the day of the year is set, figure out what it is
16773 if (config._dayOfYear != null) {
16774 yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
16775
16776 if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) {
16777 getParsingFlags(config)._overflowDayOfYear = true;
16778 }
16779
16780 date = createUTCDate(yearToUse, 0, config._dayOfYear);
16781 config._a[MONTH] = date.getUTCMonth();
16782 config._a[DATE] = date.getUTCDate();
16783 }
16784
16785 // Default to current date.
16786 // * if no year, month, day of month are given, default to today
16787 // * if day of month is given, default month and year
16788 // * if month is given, default only year
16789 // * if year is given, don't default anything
16790 for (i = 0; i < 3 && config._a[i] == null; ++i) {
16791 config._a[i] = input[i] = currentDate[i];
16792 }
16793
16794 // Zero out whatever was not defaulted, including time
16795 for (; i < 7; i++) {
16796 config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];
16797 }
16798
16799 // Check for 24:00:00.000
16800 if (config._a[HOUR] === 24 &&
16801 config._a[MINUTE] === 0 &&
16802 config._a[SECOND] === 0 &&
16803 config._a[MILLISECOND] === 0) {
16804 config._nextDay = true;
16805 config._a[HOUR] = 0;
16806 }
16807
16808 config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);
16809 expectedWeekday = config._useUTC ? config._d.getUTCDay() : config._d.getDay();
16810
16811 // Apply timezone offset from input. The actual utcOffset can be changed
16812 // with parseZone.
16813 if (config._tzm != null) {
16814 config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
16815 }

Callers 3

configFromObjectFunction · 0.85
configFromInputFunction · 0.85

Calls 6

currentDateArrayFunction · 0.85
dayOfYearFromWeekInfoFunction · 0.85
defaultsFunction · 0.85
daysInYearFunction · 0.85
getParsingFlagsFunction · 0.85
createUTCDateFunction · 0.85

Tested by

no test coverage detected