Skip to content

Commit fe2f0b3

Browse files
committed
Adjust start_date and end_date report depending of the administrator time zone
1 parent 75e909a commit fe2f0b3

File tree

2 files changed

+52
-53
lines changed

2 files changed

+52
-53
lines changed
Lines changed: 48 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,51 @@
11
<div class="row scroll-table mt-5 ml-0">
2-
<table
3-
class="table table-striped mb-0"
4-
datatable
5-
[dtTrigger]="dtTrigger"
6-
[dtOptions]="dtOptions"
7-
*ngIf="(reportDataSource$ | async) as dataSource">
8-
<thead class="thead-blue">
9-
<tr class="d-flex">
10-
<th class="hidden-col">ID</th>
11-
<th class="col md-col">User email</th>
12-
<th class="col sm-col">Date</th>
13-
<th class="col sm-col" title="Duration (hours)">Duration</th>
14-
<th class="col x-sm-col" title="Time in">Time in</th>
15-
<th class="col x-sm-col" title="Time out">Time out</th>
16-
<th class="col md-col">Project</th>
17-
<th class="hidden-col">Project ID</th>
18-
<th class="col md-col">Customer</th>
19-
<th class="hidden-col">Customer ID</th>
20-
<th class="col md-col">Activity</th>
21-
<th class="col lg-col">Ticket</th>
22-
<th class="col lg-col">Description</th>
23-
<th class="col lg-col">Technologies</th>
24-
</tr>
25-
</thead>
26-
<app-loading-bar *ngIf="dataSource.isLoading"></app-loading-bar>
27-
<tbody *ngIf="!dataSource.isLoading">
28-
<tr class="d-flex" *ngFor="let entry of dataSource.data">
29-
<td class="hidden-col">{{ entry.id }}</td>
30-
<td class="col md-col">{{ entry.owner_email }}</td>
31-
<td class="col sm-col">
32-
{{ entry.start_date | date: 'MM/dd/yyyy' }}
33-
</td>
34-
<td class="col sm-col">
35-
{{ entry.end_date | substractDate: entry.start_date }}
36-
</td>
37-
<td class="col x-sm-col">{{ entry.start_date | date: 'HH:mm' }}</td>
38-
<td class="col x-sm-col">{{ entry.end_date | date: 'HH:mm' }}</td>
39-
<td class="col md-col">{{ entry.project_name }}</td>
40-
<td class="hidden-col">{{ entry.project_id }}</td>
41-
<td class="col md-col">{{ entry.customer_name }}</td>
42-
<td class="hidden-col">{{ entry.customer_id }}</td>
43-
<td class="col md-col">{{ entry.activity_name }}</td>
44-
<td class="col lg-col">
45-
<ng-container *ngIf="entry.uri !== null">
46-
<a [class.is-url]="isURL(entry.uri)" (click)="openURLInNewTab(entry.uri)">
2+
<table class="table table-striped mb-0" datatable [dtTrigger]="dtTrigger" [dtOptions]="dtOptions" *ngIf="(reportDataSource$ | async) as dataSource">
3+
<thead class="thead-blue">
4+
<tr class="d-flex">
5+
<th class="hidden-col">ID</th>
6+
<th class="col md-col">User email</th>
7+
<th class="col sm-col">Date</th>
8+
<th class="col sm-col" title="Duration (hours)">Duration</th>
9+
<th class="col x-sm-col" title="Time in">Time in</th>
10+
<th class="col x-sm-col" title="Time out">Time out</th>
11+
<th class="col md-col">Project</th>
12+
<th class="hidden-col">Project ID</th>
13+
<th class="col md-col">Customer</th>
14+
<th class="hidden-col">Customer ID</th>
15+
<th class="col md-col">Activity</th>
16+
<th class="col lg-col">Ticket</th>
17+
<th class="col lg-col">Description</th>
18+
<th class="col lg-col">Technologies</th>
19+
</tr>
20+
</thead>
21+
<app-loading-bar *ngIf="dataSource.isLoading"></app-loading-bar>
22+
<tbody *ngIf="!dataSource.isLoading">
23+
<tr class="d-flex" *ngFor="let entry of dataSource.data">
24+
<td class="hidden-col">{{ entry.id }}</td>
25+
<td class="col md-col">{{ entry.owner_email }}</td>
26+
<td class="col sm-col">
27+
{{ entry.start_date | date: 'MM/dd/yyyy' }}
28+
</td>
29+
<td class="col sm-col">
30+
{{ entry.end_date | substractDate: entry.start_date }}
31+
</td>
32+
<td class="col x-sm-col">{{ parseDateToUTC(entry.start_date) }}</td>
33+
<td class="col x-sm-col">{{ parseDateToUTC(entry.end_date) }}</td>
34+
<td class="col md-col">{{ entry.project_name }}</td>
35+
<td class="hidden-col">{{ entry.project_id }}</td>
36+
<td class="col md-col">{{ entry.customer_name }}</td>
37+
<td class="hidden-col">{{ entry.customer_id }}</td>
38+
<td class="col md-col">{{ entry.activity_name }}</td>
39+
<td class="col lg-col">
40+
<ng-container *ngIf="entry.uri !== null">
41+
<a [class.is-url]="isURL(entry.uri)" (click)="openURLInNewTab(entry.uri)">
4742
{{ entry.uri }}
4843
</a>
49-
</ng-container>
50-
</td>
51-
<td class="col lg-col">{{ entry.description }}</td>
52-
<td class="col lg-col">{{ entry.technologies }}</td>
53-
</tr>
54-
</tbody>
55-
</table>
56-
</div>
44+
</ng-container>
45+
</td>
46+
<td class="col lg-col">{{ entry.description }}</td>
47+
<td class="col lg-col">{{ entry.technologies }}</td>
48+
</tr>
49+
</tbody>
50+
</table>
51+
</div>

src/app/modules/reports/components/time-entries-table/time-entries-table.component.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,5 +105,9 @@ export class TimeEntriesTableComponent implements OnInit, OnDestroy, AfterViewIn
105105
const durationColumnIndex = 3;
106106
return column === durationColumnIndex ? moment.duration(dataFormated).asHours().toFixed(2) : dataFormated;
107107
}
108+
109+
parseDateToUTC(date): string{
110+
return moment(date).utc(true).format("HH:MM");
111+
}
108112
}
109113

0 commit comments

Comments
 (0)