humanize seconds in table

This commit is contained in:
Tim Herbst 2020-12-28 11:58:22 +01:00
parent 1b82cd6b8f
commit 3f3dd14e8f
4 changed files with 12 additions and 5 deletions

View File

@ -10761,6 +10761,11 @@
"ajv-keywords": "^3.5.2"
}
},
"seconds-to-human-time": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/seconds-to-human-time/-/seconds-to-human-time-1.0.0.tgz",
"integrity": "sha512-ojOSaCcU8nkmR3tC/5GPIwmBAH4go7q1iyWRZhxB+tIKbR3rO3dDW5L73ZVRmAMNbK2AY1otz4QXCTxZXUHcXg=="
},
"select-hose": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz",

View File

@ -31,6 +31,7 @@
"ng-apexcharts": "^1.5.6",
"popper.js": "^1.14.3",
"rxjs": "~6.6.0",
"seconds-to-human-time": "^1.0.0",
"tslib": "^2.0.0",
"zone.js": "~0.10.2"
},

View File

@ -92,7 +92,7 @@
<ng-container matColumnDef="avgDuration">
<th *matHeaderCellDef mat-header-cell> average lend duration</th>
<td *matCellDef="let element" mat-cell> {{element.avgDuration}} </td>
<td *matCellDef="let element" mat-cell> {{humanizeAvgDuration(element.avgDuration)}} </td>
</ng-container>
<tr *matHeaderRowDef="displayedColumnsTo" mat-header-row></tr>
@ -114,7 +114,7 @@
<ng-container matColumnDef="avgDuration">
<th *matHeaderCellDef mat-header-cell> average lend duration</th>
<td *matCellDef="let element" mat-cell> {{element.avgDuration}} </td>
<td *matCellDef="let element" mat-cell> {{humanizeAvgDuration(element.avgDuration)}} </td>
</ng-container>
<tr *matHeaderRowDef="displayedColumnsFrom" mat-header-row></tr>

View File

@ -5,7 +5,8 @@ import {IDashboardCommonBikePoint} from '../service/domain/dashboard-common-bike
import {MatTableDataSource} from '@angular/material/table';
import {FormBuilder, FormControl, FormGroup} from '@angular/forms';
import {MapService} from '../service/map.service';
import 'humanize-duration/humanize-duration';
import stht from "seconds-to-human-time";
import {
ApexAxisChartSeries,
@ -473,7 +474,7 @@ export class DashboardComponent implements OnInit {
});
}
routeToStation(stationId: string): void {
this.router.navigate(['/dashboard', stationId]);
humanizeAvgDuration(avgDuration: number): string {
return stht(avgDuration);
}
}