Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: TT-336 Fix format Duration column
  • Loading branch information
Edgar Guaman committed Sep 17, 2021
commit 778918b23bd8466a371177a3bcfe6d6a999eb4ed
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { formatDate } from '@angular/common';
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';
import { Observable, Subject, Subscription } from 'rxjs';
import { Entry } from 'src/app/modules/shared/models';
import { DataSource } from 'src/app/modules/shared/models/data-source.model';
Expand All @@ -28,11 +29,29 @@ export class TimeEntriesTableComponent implements OnInit, OnDestroy, AfterViewIn
},
{
extend: 'excel',
exportOptions: {
format: {
body: (data, row, column, node) => {
return column === 3 ?
moment.duration(data).asHours().toFixed(4).slice(0, -1) :
data;
},
}
},
text: 'Excel',
filename: `time-entries-${formatDate(new Date(), 'MM_dd_yyyy-HH_mm', 'en')}`
},
{
extend: 'csv',
exportOptions: {
format: {
body: (data, row, column, node) => {
return column === 3 ?
moment.duration(data).asHours().toFixed(4).slice(0, -1) :
data;
},
}
},
text: 'CSV',
filename: `time-entries-${formatDate(new Date(), 'MM_dd_yyyy-HH_mm', 'en')}`
},
Expand Down