import { Pipe, PipeTransform } from '@angular/core';

@Pipe({name: 'timeSpent'})
export class TimeElapsedPipe implements PipeTransform {
    transform(secs: number): string {
        if(secs >= 0) {
            let min = Math.floor(secs / 60);
            let sec = secs % 60;
            return `${min}min ${sec}sec`;
        } else {
            let min = Math.floor(-secs / 60);
            let sec = -secs % 60;
            return `-${min}min ${sec}sec`;
        }
    }
}
import { Pipe, PipeTransform } from '@angular/core';

@Pipe({name: 'timeElapsed'})
export class TimeElapsedPipe implements PipeTransform {
    transform(secs: number): string {
        let min = Math.floor(secs / 60);
        let sec = secs % 60;
        return `${min}min ${sec}sec`;
    }
}
--- 
+++ 
@@ -1,10 +1,16 @@
 import { Pipe, PipeTransform } from '@angular/core';
 
-@Pipe({name: 'timeElapsed'})
+@Pipe({name: 'timeSpent'})
 export class TimeElapsedPipe implements PipeTransform {
     transform(secs: number): string {
-        let min = Math.floor(secs / 60);
-        let sec = secs % 60;
-        return `${min}min ${sec}sec`;
+        if(secs >= 0) {
+            let min = Math.floor(secs / 60);
+            let sec = secs % 60;
+            return `${min}min ${sec}sec`;
+        } else {
+            let min = Math.floor(-secs / 60);
+            let sec = -secs % 60;
+            return `-${min}min ${sec}sec`;
+        }
     }
 }
Refactor to handle negative values (when the counter is set to do a countdown). Applied red color to the text when the time expires
