]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/duration.pipe.ts
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / shared / pipes / duration.pipe.ts
index c2b874ac4570c8feb4b75da449dbcf7a7ac0b867..4675fc0f6c6d6fbe5c85af7b513c160d8353139f 100644 (file)
@@ -1,20 +1,10 @@
 import { Pipe, PipeTransform } from '@angular/core';
 
-import * as moment from 'moment';
-
 @Pipe({
   name: 'duration',
   pure: false
 })
 export class DurationPipe implements PipeTransform {
-  transform(date: any, isRelative = false): string {
-    if (isRelative) {
-      return moment(date).fromNow();
-    } else {
-      return this._forHumans(date);
-    }
-  }
-
   /**
    * Translates seconds into human readable format of seconds, minutes, hours, days, and years
    * source: https://stackoverflow.com/a/34270811
@@ -22,7 +12,7 @@ export class DurationPipe implements PipeTransform {
    * @param  {number} seconds The number of seconds to be processed
    * @return {string}         The phrase describing the the amount of time
    */
-  _forHumans(seconds: number): string {
+  transform(seconds: number): string {
     const levels = [
       [`${Math.floor(seconds / 31536000)}`, 'years'],
       [`${Math.floor((seconds % 31536000) / 86400)}`, 'days'],