Skip to content

Commit 9c7c876

Browse files
fix: TT-529 sort by date not working correctly on reports
1 parent 3aff2e5 commit 9c7c876

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { formatDate } from '@angular/common';
2-
import { AfterViewInit, Component, OnDestroy, OnInit, ViewChild} from '@angular/core';
2+
import { AfterViewInit, Component, OnDestroy, OnInit, ViewChild } from '@angular/core';
33
import { select, Store } from '@ngrx/store';
44
import { DataTableDirective } from 'angular-datatables';
55
import * as moment from 'moment';
@@ -50,7 +50,8 @@ export class TimeEntriesTableComponent implements OnInit, OnDestroy, AfterViewIn
5050
text: 'CSV',
5151
filename: `time-entries-${formatDate(new Date(), 'MM_dd_yyyy-HH_mm', 'en')}`
5252
},
53-
]
53+
],
54+
columnDefs: [{ type: 'date', targets: 2 }]
5455
};
5556
dtTrigger: Subject<any> = new Subject();
5657
@ViewChild(DataTableDirective, { static: false })
@@ -81,11 +82,11 @@ export class TimeEntriesTableComponent implements OnInit, OnDestroy, AfterViewIn
8182
private rerenderDataTable(): void {
8283
if (this.dtElement && this.dtElement.dtInstance) {
8384
this.dtElement.dtInstance.then((dtInstance: DataTables.Api) => {
84-
dtInstance.destroy();
85-
this.dtTrigger.next();
85+
dtInstance.destroy();
86+
this.dtTrigger.next();
8687
});
8788
} else {
88-
this.dtTrigger.next();
89+
this.dtTrigger.next();
8990
}
9091
}
9192

@@ -98,7 +99,7 @@ export class TimeEntriesTableComponent implements OnInit, OnDestroy, AfterViewIn
9899
return regex.test(uri);
99100
}
100101

101-
bodyExportOptions(data, row, column, node){
102+
bodyExportOptions(data, row, column, node) {
102103
const dataFormated = data.toString().replace(/<((.|\n){0,200}?)>/gi, '');
103104
const durationColumnIndex = 3;
104105
return column === durationColumnIndex ? moment.duration(dataFormated).asHours().toFixed(2) : dataFormated;

src/app/modules/time-clock/store/entry.effects.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ export class EntryEffects {
143143
if (error.status === 404) {
144144
return of(new actions.CreateEntry(entry));
145145
} else {
146-
this.toastrService.error('We could not clock in you, try again later.');
146+
this.toastrService.error('We could not clock you in, try again later.');
147147
return of(new actions.CreateEntryFail('Error'));
148148
}
149149
})

0 commit comments

Comments
 (0)