function getWeekOfMonth(date) {
      var firstDayOfMonth = getFirstDateOfMonth(date);
      return Math.floor((firstDayOfMonth.getDay() + date.getDate() - 1) / 7);
    }
Gets the week of the month that a given date occurs in.
@param {Date} date
@returns {number} Index of the week of the month (zero-based).