This entire block is unnecessary - note that the original implementation line 202 contains a comment that the start date should be updated to handle a different start date. The following is all that is needed to get the dates correct:

var startDate = moment.utc(startOfMonth).subtract(startOfMonth.day() - configuration.weekStart, 'days');

Then make the day labels correct by adjusting the loop to start on the correct day of week, as follows:

for (var dayNumber = configuration.weekStart; dayNumber < configuration.weekStart + 7; dayNumber++) {
    result.dayNames.push(moment.utc().day(dayNumber).format('dd'));
 }