var log4js = require('log4js'); var logger = log4js.getLogger(); var calHandler = require('./today/calHandler'); require('sugar-date'); var cal = {today: [], tomorrow: [], week: []}; var _cal_tmp = {today: [], tomorrow: [], week: []}; for (var t = 0; t < calHandler.calendars.length;t++) { calHandler.getAdvancedCalV3(calHandler.calendars[t]) .then((d) => { 'use strict'; cal.today = cal.today.concat(d.today); cal.tomorrow = cal.tomorrow.concat(d.tomorrow); cal.week = cal.week.concat(d.week); logger.error(cal); }) .catch((e) => { 'use strict'; logger.error(e); }); }