From 9c7c8768363f50c82de55b62ffa843226588ec4c Mon Sep 17 00:00:00 2001 From: Michael Villarruel Date: Wed, 2 Feb 2022 12:43:23 -0500 Subject: [PATCH] fix: TT-529 sort by date not working correctly on reports --- .../time-entries-table.component.ts | 13 +++++++------ src/app/modules/time-clock/store/entry.effects.ts | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/app/modules/reports/components/time-entries-table/time-entries-table.component.ts b/src/app/modules/reports/components/time-entries-table/time-entries-table.component.ts index 5658a972e..8b92e666b 100644 --- a/src/app/modules/reports/components/time-entries-table/time-entries-table.component.ts +++ b/src/app/modules/reports/components/time-entries-table/time-entries-table.component.ts @@ -1,5 +1,5 @@ import { formatDate } from '@angular/common'; -import { AfterViewInit, Component, OnDestroy, OnInit, ViewChild} from '@angular/core'; +import { AfterViewInit, Component, OnDestroy, OnInit, ViewChild } from '@angular/core'; import { select, Store } from '@ngrx/store'; import { DataTableDirective } from 'angular-datatables'; import * as moment from 'moment'; @@ -50,7 +50,8 @@ export class TimeEntriesTableComponent implements OnInit, OnDestroy, AfterViewIn text: 'CSV', filename: `time-entries-${formatDate(new Date(), 'MM_dd_yyyy-HH_mm', 'en')}` }, - ] + ], + columnDefs: [{ type: 'date', targets: 2 }] }; dtTrigger: Subject = new Subject(); @ViewChild(DataTableDirective, { static: false }) @@ -81,11 +82,11 @@ export class TimeEntriesTableComponent implements OnInit, OnDestroy, AfterViewIn private rerenderDataTable(): void { if (this.dtElement && this.dtElement.dtInstance) { this.dtElement.dtInstance.then((dtInstance: DataTables.Api) => { - dtInstance.destroy(); - this.dtTrigger.next(); + dtInstance.destroy(); + this.dtTrigger.next(); }); } else { - this.dtTrigger.next(); + this.dtTrigger.next(); } } @@ -98,7 +99,7 @@ export class TimeEntriesTableComponent implements OnInit, OnDestroy, AfterViewIn return regex.test(uri); } - bodyExportOptions(data, row, column, node){ + bodyExportOptions(data, row, column, node) { const dataFormated = data.toString().replace(/<((.|\n){0,200}?)>/gi, ''); const durationColumnIndex = 3; return column === durationColumnIndex ? moment.duration(dataFormated).asHours().toFixed(2) : dataFormated; diff --git a/src/app/modules/time-clock/store/entry.effects.ts b/src/app/modules/time-clock/store/entry.effects.ts index 98527cc58..40c1cb1c9 100644 --- a/src/app/modules/time-clock/store/entry.effects.ts +++ b/src/app/modules/time-clock/store/entry.effects.ts @@ -143,7 +143,7 @@ export class EntryEffects { if (error.status === 404) { return of(new actions.CreateEntry(entry)); } else { - this.toastrService.error('We could not clock in you, try again later.'); + this.toastrService.error('We could not clock you in, try again later.'); return of(new actions.CreateEntryFail('Error')); } })