var runInSecond = matchPattern(task.expressions[0], date.getSeconds());
var runOnMinute = matchPattern(task.expressions[1], date.getMinutes());
var runOnHour = matchPattern(task.expressions[2], date.getHours());
var runOnDayOfMonth = matchPattern(task.expressions[3], date.getDate());
var runOnMonth = matchPattern(task.expressions[4], date.getMonth() + 1);
var runOnDayOfWeek = matchPattern(task.expressions[5], date.getDay());
var runOnDay = false;
var delta = task.initialPattern.length === 6 ? 0 : -1;
if (task.initialPattern[3 + delta] === '*') {
runOnDay = runOnDayOfWeek;
} else if (task.initialPattern[5 + delta] === '*') {
runOnDay = runOnDayOfMonth;
} else {
runOnDay = runOnDayOfMonth || runOnDayOfWeek;
}
return runInSecond && runOnMinute && runOnHour && runOnDay && runOnMonth;
}
Это сильно
Обсуждают сегодня