(config)
| 2575 | // note: all values past the year are optional and will default to the lowest possible value. |
| 2576 | // [year, month, day , hour, minute, second, millisecond] |
| 2577 | function configFromArray(config) { |
| 2578 | var i, |
| 2579 | date, |
| 2580 | input = [], |
| 2581 | currentDate, |
| 2582 | expectedWeekday, |
| 2583 | yearToUse; |
| 2584 | |
| 2585 | if (config._d) { |
| 2586 | return; |
| 2587 | } |
| 2588 | |
| 2589 | currentDate = currentDateArray(config); |
| 2590 | |
| 2591 | //compute day of the year from weeks and weekdays |
| 2592 | if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { |
| 2593 | dayOfYearFromWeekInfo(config); |
| 2594 | } |
| 2595 | |
| 2596 | //if the day of the year is set, figure out what it is |
| 2597 | if (config._dayOfYear != null) { |
| 2598 | yearToUse = defaults(config._a[YEAR], currentDate[YEAR]); |
| 2599 | |
| 2600 | if ( |
| 2601 | config._dayOfYear > daysInYear(yearToUse) || |
| 2602 | config._dayOfYear === 0 |
| 2603 | ) { |
| 2604 | getParsingFlags(config)._overflowDayOfYear = true; |
| 2605 | } |
| 2606 | |
| 2607 | date = createUTCDate(yearToUse, 0, config._dayOfYear); |
| 2608 | config._a[MONTH] = date.getUTCMonth(); |
| 2609 | config._a[DATE] = date.getUTCDate(); |
| 2610 | } |
| 2611 | |
| 2612 | // Default to current date. |
| 2613 | // * if no year, month, day of month are given, default to today |
| 2614 | // * if day of month is given, default month and year |
| 2615 | // * if month is given, default only year |
| 2616 | // * if year is given, don't default anything |
| 2617 | for (i = 0; i < 3 && config._a[i] == null; ++i) { |
| 2618 | config._a[i] = input[i] = currentDate[i]; |
| 2619 | } |
| 2620 | |
| 2621 | // Zero out whatever was not defaulted, including time |
| 2622 | for (; i < 7; i++) { |
| 2623 | config._a[i] = input[i] = |
| 2624 | config._a[i] == null ? (i === 2 ? 1 : 0) : config._a[i]; |
| 2625 | } |
| 2626 | |
| 2627 | // Check for 24:00:00.000 |
| 2628 | if ( |
| 2629 | config._a[HOUR] === 24 && |
| 2630 | config._a[MINUTE] === 0 && |
| 2631 | config._a[SECOND] === 0 && |
| 2632 | config._a[MILLISECOND] === 0 |
| 2633 | ) { |
| 2634 | config._nextDay = true; |
no test coverage detected