//对于请假开始时间和结束时间中间的周末去除处理
//days总天数(未去除周末)
function checkWeekDay(beginDay, endDay, days) {
var weekEndCount = 0;
if (days < 1) {
//判断开始时间是否是周末
if (beginDay.getDay() == 6 || beginDay.getDay() == 0)
{
weekEndCount += 1;
}
} else if (days < 7)
{
if (beginDay.getDay() < endDay.getDay() && endDay.getDay() == 6)
{
weekEndCount += 1;
}
else if (beginDay.getDay() < endDay.getDay() && beginDay.getDay() == 0) {
weekEndCount += 1;
} else if (beginDay.getDay() > endDay.getDay()) {
weekEndCount += 2;
}
}
else if (days >= 7) {
if (days % 7 > 1) {
//以周六为界限,判断开始时间和周六的差值与总天数除以7的余数的关系判断是否需要增加额外的周末
if (6 - beginDay.getDay() == days % 7) {
weekEndCount += parseInt(days / 7) * 2;
} else if (6 - beginDay.getDay() + 1 == days % 7) {
weekEndCount += parseInt(days / 7) * 2;
weekEndCount += 1;
} else {
weekEndCount += parseInt(days / 7) * 2;
weekEndCount += 2;
}
} else {
weekEndCount += parseInt(days / 7) * 2;
}
}
return weekEndCount;
}