code: function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {
          var end = firstDayOfWeekOfYear - firstDayOfWeek,
              daysToDayOfWeek = firstDayOfWeekOfYear - mom.day();
  
  
          if (daysToDayOfWeek > end) {
              daysToDayOfWeek -= 7;
          }
  
          if (daysToDayOfWeek < end - 7) {
              daysToDayOfWeek += 7;
          }
  
          return Math.ceil(moment(mom).add('d', daysToDayOfWeek).dayOfYear() / 7);
      }
docs: firstDayOfWeek       0 = sun, 6 = sat the day of the week that starts the week (usually sunday or monday) firstDayOfWeekOfYear 0 = sun, 6 = sat the first week is the week that contains the first of this day of the week (eg. ISO weeks use thursday (4))