Skip to content

Commit 1d0e308

Browse files
committed
Modify: change rotation schedule
1 parent 4db34bc commit 1d0e308

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

Diff for: src/rotation/rotations.service.ts

+4-7
Original file line numberDiff line numberDiff line change
@@ -668,27 +668,24 @@ export class RotationsService {
668668
let tmpWeekArray: DayObject[] = [];
669669

670670
for (let i = 1; i <= daysOfMonth; i++) {
671-
if (new Date(year, month - 1, i).getDay() > 0 && new Date(year, month - 1, i).getDay() < 6) {
671+
const dayOfWeek = new Date(year, month - 1, i).getDay();
672+
673+
if (dayOfWeek === 1 || dayOfWeek === 3 || dayOfWeek === 5) {
672674
const day = new Date(year, month - 1, i).getDate();
673675

674676
if (!holidayArrayOfMonth.includes(day)) {
675-
// const tmpDayObject: DayObject = { day, arr: [0, 0] };
676677
const tmpDayObject: DayObject = { day, arr: [0] };
677678

678679
tmpWeekArray.push(tmpDayObject);
679680

680681
if (i === daysOfMonth) {
681682
MonthArray.push(tmpWeekArray);
682683
}
683-
} else {
684-
continue;
685684
}
686-
} else {
685+
} else if (dayOfWeek === 6 || i === daysOfMonth) {
687686
if (tmpWeekArray.length > 0) {
688687
MonthArray.push(tmpWeekArray);
689688
tmpWeekArray = [];
690-
} else {
691-
// already pushed tmpWeekArray
692689
}
693690
}
694691
}

0 commit comments

Comments
 (0)