Skip to content

Commit 94d3292

Browse files
committed
Adding temporary fix for the period selector.
1 parent 79731bc commit 94d3292

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

eform-client/src/app/plugins/modules/time-planning-pn/components/plannings/time-plannings-container/time-plannings-container.component.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ export class TimePlanningsContainerComponent implements OnInit, OnDestroy {
101101
}
102102

103103
goBackward() {
104+
const tempEndDate = new Date(this.dateTo);
105+
tempEndDate.setHours(0, 0, 0, 0);
106+
107+
let daysCount = Math.ceil((tempEndDate.getTime() - this.dateFrom.getTime()) / (1000 * 3600 * 24)) * -1;
104108
this.dateFrom = this.addDays(this.dateFrom, -7);
105109
this.dateTo = this.addDays(this.dateTo, -7);
106110
this.getPlannings();
@@ -119,8 +123,11 @@ export class TimePlanningsContainerComponent implements OnInit, OnDestroy {
119123
}
120124

121125
goForward() {
122-
this.dateFrom = this.addDays(this.dateFrom, 7);
123-
this.dateTo = this.addDays(this.dateTo, 7);
126+
const tempEndDate = new Date(this.dateTo);
127+
tempEndDate.setHours(0, 0, 0, 0);
128+
let daysCount = Math.ceil((tempEndDate.getTime() - this.dateFrom.getTime()) / (1000 * 3600 * 24));
129+
this.dateFrom = this.addDays(this.dateFrom, +7);
130+
this.dateTo = this.addDays(this.dateTo, +7);
124131
this.getPlannings();
125132
}
126133

eform-client/src/app/plugins/modules/time-planning-pn/components/plannings/time-plannings-table/time-plannings-table.component.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,12 @@ export class TimePlanningsTableComponent implements OnInit, OnChanges {
7373
private updateTableHeaders(): void {
7474
this.tableHeaders = [];
7575
this.cdr.detectChanges();
76-
// debugger;
7776
const startDate = new Date(this.dateFrom);
7877
const endDate = new Date(this.dateTo);
7978
const today = new Date();
80-
let daysCount = Math.ceil((endDate.getTime() - startDate.getTime()) / (1000 * 3600 * 24));
81-
if (endDate.getHours() === 23) {
82-
daysCount--;
83-
}
79+
const tempEndDate = new Date(endDate);
80+
tempEndDate.setHours(0, 0, 0, 0);
81+
let daysCount = Math.ceil((tempEndDate.getTime() - startDate.getTime()) / (1000 * 3600 * 24)) +1;
8482
let todayTranslated = this.translateService.stream('Today');
8583

8684
this.tableHeaders = [

0 commit comments

Comments
 (0)