src/seeker.js
function(parts, date, reverse) {
  var operation = 'add';
  var reset = 'startOf';
  if (reverse) {
    operation = 'subtract';
    reset = 'endOf';
    date.subtract(1, 'minute'); // Ensure prev and next cannot be same time
  }
  var retry = 24;
  while (--retry) {
    shiftMonth(parts, date, operation, reset);
    var monthChanged = shiftDay(parts, date, operation, reset);
    if (!monthChanged) {
      var dayChanged = shiftHour(parts, date, operation, reset);
      if (!dayChanged) {
        var hourChanged = shiftMinute(parts, date, operation, reset);
        if (!hourChanged) {
          break;
        }
      }
    }
  }
  if (!retry) {
    throw new Error('Unable to find execution time for schedule');
  }
  date.seconds(0).milliseconds(0);
  // Return new moment object
  return moment(date);
}
function(parts, date, reverse) {
  var operation = 'add';
  var reset = 'startOf';
  if (reverse) {
    operation = 'subtract';
    reset = 'endOf';
    date.subtract(1, 'minute'); // Ensure prev and next cannot be same time
  }
  var retry = 24;
  while (--retry) {
    shiftMonth(parts, date, operation, reset);
    var monthChanged = shiftDay(parts, date, operation, reset);
    if (!monthChanged) {
      var dayChanged = shiftHour(parts, date, operation, reset);
      if (!dayChanged) {
        var hourChanged = shiftMinute(parts, date, operation, reset);
        if (!hourChanged) {
          break;
        }
      }
    }
  }
  if (!retry) {
    throw new Error('Unable to find execution time for schedule');
  }
  date.seconds(0).milliseconds(0);
  // Return new moment object
  return moment(date);
}
function ( parts , date , reverse ) { var operation = 'add' ; var reset = 'startOf' ; if ( reverse ) { operation = 'subtract' ; reset = 'endOf' ; date . subtract ( 1 , 'minute' ) ; // Ensure prev and next cannot be same time } var retry = 24 ; while ( -- retry ) { shiftMonth ( parts , date , operation , reset ) ; var monthChanged = shiftDay ( parts , date , operation , reset ) ; if ( ! monthChanged ) { var dayChanged = shiftHour ( parts , date , operation , reset ) ; if ( ! dayChanged ) { var hourChanged = shiftMinute ( parts , date , operation , reset ) ; if ( ! hourChanged ) { break ; } } } } if ( ! retry ) { throw new Error ( 'Unable to find execution time for schedule' ) ; } date . seconds ( 0 ) . milliseconds ( 0 ) ; // Return new moment object return moment ( date ) ; }
Returns the time the schedule would run next.

@param {array} parts An array of Cron parts.
@param {Date} date The reference date.
@param {boolean} reverse Whether to find the previous value instead of next.
@return {Moment} The date the schedule would have executed at.
Returns the time the schedule would run next .