lib/expression.js
function isNthDayMatch(date, nthDayOfWeek) {
    if (nthDayOfWeek < 6) {
      if (
        date.getDate() < 8 &&
        nthDayOfWeek === 1 // First occurence has to happen in first 7 days of the month
      ) {
        return true;
      }

      var offset = date.getDate() % 7 ? 1 : 0; // Math is off by 1 when dayOfWeek isn't divisible by 7
      var adjustedDate = date.getDate() - (date.getDate() % 7); // find the first occurance
      var occurrence = Math.floor(adjustedDate / 7) + offset;

      return occurrence === nthDayOfWeek;
    }

    return false;
  }
function isNthDayMatch(date, nthDayOfWeek) {
    if (nthDayOfWeek < 6) {
      if (
        date.getDate() < 8 &&
        nthDayOfWeek === 1 // First occurence has to happen in first 7 days of the month
      ) {
        return true;
      }

      var offset = date.getDate() % 7 ? 1 : 0; // Math is off by 1 when dayOfWeek isn't divisible by 7
      var adjustedDate = date.getDate() - (date.getDate() % 7); // find the first occurance
      var occurrence = Math.floor(adjustedDate / 7) + offset;

      return occurrence === nthDayOfWeek;
    }

    return false;
  }
function isNthDayMatch ( date , nthDayOfWeek ) { if ( nthDayOfWeek < 6 ) { if ( date . getDate ( ) < 8 && nthDayOfWeek === 1 // First occurence has to happen in first 7 days of the month ) { return true ; } var offset = date . getDate ( ) % 7 ? 1 : 0 ; // Math is off by 1 when dayOfWeek isn't divisible by 7 var adjustedDate = date . getDate ( ) - ( date . getDate ( ) % 7 ) ; // find the first occurance var occurrence = Math . floor ( adjustedDate / 7 ) + offset ; return occurrence === nthDayOfWeek ; } return false ; }
Helps determine if the provided date is the correct nth occurence of the
desired day of week.

@param {CronDate} date
@param {Number} nthDayOfWeek
@return {Boolean}
@private
Helps determine if the provided date is the correct nth occurence of the desired day of week .