Skip to content
Closed
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: #429 set duration column as duration format in xls
  • Loading branch information
enriquezrene committed Jul 21, 2020
commit 4c68073a6c074d92129310e76aa3da23d8944fcb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {EntryState} from '../../../time-clock/store/entry.reducer';
import {entriesForReport} from '../../../time-clock/store/entry.selectors';
import {Subject} from 'rxjs';
import {DataTableDirective} from 'angular-datatables';
import * as moment from 'moment';

@Component({
selector: 'app-time-entries-table',
Expand All @@ -13,6 +14,7 @@ import {DataTableDirective} from 'angular-datatables';
})
export class TimeEntriesTableComponent implements OnInit, OnDestroy, AfterViewInit {
data = [];

dtOptions: any = {
scrollY: '600px',
paging: false,
Expand All @@ -22,11 +24,27 @@ export class TimeEntriesTableComponent implements OnInit, OnDestroy, AfterViewIn
'print',
{
extend: 'excel',
exportOptions: {
format: {
body: ( data, row, column, node ) => {
return column === 2 ?
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 === 2 ?
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