Convert Ms unit + fun with approximative pipe
This commit is contained in:
@@ -13,6 +13,7 @@ import { ElsService } from './els.service';
|
||||
import { AppRoutingModule } from './app-routing.module';
|
||||
|
||||
import { ConvertMsPipe } from './convertms.pipe';
|
||||
import { ConvertMoreExactPipe } from './convert-more-exact.pipe';
|
||||
import { SortByPipe } from './sort-by.pipe';
|
||||
|
||||
@NgModule({
|
||||
@@ -28,6 +29,7 @@ import { SortByPipe } from './sort-by.pipe';
|
||||
ArtistComponent,
|
||||
GenreComponent,
|
||||
ConvertMsPipe,
|
||||
ConvertMoreExactPipe,
|
||||
SortByPipe
|
||||
],
|
||||
providers: [
|
||||
|
||||
@@ -23,10 +23,10 @@ export class ConvertMsPipe implements PipeTransform {
|
||||
|
||||
// Final string
|
||||
let ret = '';
|
||||
if (days > 0) { ret += ('0' + days).slice(-2) + ':'; }
|
||||
if (hours > 0) { ret += ('0' + hours).slice(-2) + ':'; }
|
||||
if (minutes > 0) { ret += ('0' + minutes).slice(-2) + ':'; }
|
||||
if (seconds > 0) { ret += ('0' + seconds).slice(-2); }
|
||||
if (days > 0) { ret += ('0' + days).slice(-2) + 'd'; }
|
||||
if (hours > 0) { ret += ('0' + hours).slice(-2) + 'h'; }
|
||||
if (minutes > 0) { ret += ('0' + minutes).slice(-2) + 'm'; }
|
||||
if (seconds > 0) { ret += ('0' + seconds).slice(-2) + 's'; }
|
||||
|
||||
return ret;
|
||||
// return ('0' + days).slice(-2) + ':' + ('0' + hours).slice(-2) + ':' + ('0' + minutes).slice(-2) + ':' + ('0' + seconds).slice(-2);
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<h3 *ngIf="!totalTime"><span class="glyphicon glyphicon-refresh loading"></span></h3>
|
||||
<h3 *ngIf="totalTime">{{totalTime | convertMs}}</h3>
|
||||
</div>
|
||||
<div><br>Total time</div>
|
||||
<div><br>Total time ({{totalTime | convertMoreExact}})</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user