You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
399B

  1. import { Pipe, PipeTransform } from '@angular/core';
  2. import * as moment from 'moment';
  3. @Pipe({
  4. name: 'timeElapsed',
  5. })
  6. export class TimeElapsedPipe implements PipeTransform {
  7. transform(checkInTime: string | null): any {
  8. if (!checkInTime) return;
  9. const checkInMoment = moment(checkInTime);
  10. const now = moment();
  11. return moment.duration(now.diff(checkInMoment)).humanize();
  12. }
  13. }