lib/date-utils.js
function(year) {
    var self = this;
    var october31 = self.createDate(year, 10, 31);
    var secondMonth = 11;
    var allSaintsDay;

    if (self.getDayOfWeek(october31) === self.SATURDAY) {
      allSaintsDay = october31;
    } else {
      self.range(1, 6).forEach(function(day) {
        if (!allSaintsDay) {
          var date = self.createDate(year, secondMonth, day);
          var dayOfWeek = self.getDayOfWeek(date);

          if (dayOfWeek === self.SATURDAY) {
            allSaintsDay = date;
          }
        }
      });
    }

    return allSaintsDay;
  }
function(year) {
    var self = this;
    var october31 = self.createDate(year, 10, 31);
    var secondMonth = 11;
    var allSaintsDay;

    if (self.getDayOfWeek(october31) === self.SATURDAY) {
      allSaintsDay = october31;
    } else {
      self.range(1, 6).forEach(function(day) {
        if (!allSaintsDay) {
          var date = self.createDate(year, secondMonth, day);
          var dayOfWeek = self.getDayOfWeek(date);

          if (dayOfWeek === self.SATURDAY) {
            allSaintsDay = date;
          }
        }
      });
    }

    return allSaintsDay;
  }
function ( year ) { var self = this ; var october31 = self . createDate ( year , 10 , 31 ) ; var secondMonth = 11 ; var allSaintsDay ; if ( self . getDayOfWeek ( october31 ) === self . SATURDAY ) { allSaintsDay = october31 ; } else { self . range ( 1 , 6 ) . forEach ( function ( day ) { if ( ! allSaintsDay ) { var date = self . createDate ( year , secondMonth , day ) ; var dayOfWeek = self . getDayOfWeek ( date ) ; if ( dayOfWeek === self . SATURDAY ) { allSaintsDay = date ; } } } ) ; } return allSaintsDay ; }
Determines the date of All Saints' Day.
Saturday between October 31 and November 6
@param {number} year
@return {Date}
Determines the date of All Saints Day . Saturday between October 31 and November 6